Could not import _ext module.
Alobal opened this issue · comments
Alobal commented
Hehe Fan commented
嗨 你好,可以提供下更多的错误日志吗?以及怎么运行的
Alobal commented
谢谢您的回复!首先,我在modules目录下执行sudo python setup.py install
,得到以下安装信息。
running install
/usr/local/lib/python3.8/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
/usr/local/lib/python3.8/dist-packages/setuptools/command/easy_install.py:160: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py:122: PkgResourcesDeprecationWarning: 0.1.36ubuntu1 is an invalid version and will not be supported in a future release
warnings.warn(
/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py:122: PkgResourcesDeprecationWarning: 0.23ubuntu1 is an invalid version and will not be supported in a future release
warnings.warn(
running bdist_egg
running egg_info
writing pointnet2.egg-info/PKG-INFO
writing dependency_links to pointnet2.egg-info/dependency_links.txt
writing top-level names to pointnet2.egg-info/top_level.txt
/usr/local/lib/python3.8/dist-packages/torch/utils/cpp_extension.py:381: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
warnings.warn(msg.format('we could not find ninja.'))
reading manifest file 'pointnet2.egg-info/SOURCES.txt'
writing manifest file 'pointnet2.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_ext
/usr/local/lib/python3.8/dist-packages/torch/utils/cpp_extension.py:782: UserWarning: The detected CUDA version (11.6) has a minor version mismatch with the version that was used to compile PyTorch (11.3). Most likely this shouldn't be a problem.
warnings.warn(CUDA_MISMATCH_WARN.format(cuda_str_version, torch.version.cuda))
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/pointnet2
copying build/lib.linux-x86_64-3.8/pointnet2/_ext.cpython-38-x86_64-linux-gnu.so -> build/bdist.linux-x86_64/egg/pointnet2
creating stub loader for pointnet2/_ext.cpython-38-x86_64-linux-gnu.so
byte-compiling build/bdist.linux-x86_64/egg/pointnet2/_ext.py to _ext.cpython-38.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying pointnet2.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pointnet2.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pointnet2.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pointnet2.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
writing build/bdist.linux-x86_64/egg/EGG-INFO/native_libs.txt
zip_safe flag not set; analyzing archive contents...
pointnet2.__pycache__._ext.cpython-38: module references __file__
creating 'dist/pointnet2-0.0.0-py3.8-linux-x86_64.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing pointnet2-0.0.0-py3.8-linux-x86_64.egg
removing '/usr/lib/python3.8/site-packages/pointnet2-0.0.0-py3.8-linux-x86_64.egg' (and everything under it)
creating /usr/lib/python3.8/site-packages/pointnet2-0.0.0-py3.8-linux-x86_64.egg
Extracting pointnet2-0.0.0-py3.8-linux-x86_64.egg to /usr/lib/python3.8/site-packages
pointnet2 0.0.0 is already the active version in easy-install.pth
Installed /usr/lib/python3.8/site-packages/pointnet2-0.0.0-py3.8-linux-x86_64.egg
Processing dependencies for pointnet2==0.0.0
Finished processing dependencies for pointnet2==0.0.0
然后我运行测试程序 sudo python pointnet2_test.py
,得到以下错误信息。运行训练主程序也是一样的报错。
Traceback (most recent call last):
File "/home/sitch/WorkSpace/P4Transformer/modules/pointnet2_utils.py", line 26, in <module>
import pointnet2._ext as _ext
ImportError: dynamic module does not define module export function (PyInit__ext)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "pointnet2_test.py", line 16, in <module>
import pointnet2_utils
File "/home/sitch/WorkSpace/P4Transformer/modules/pointnet2_utils.py", line 29, in <module>
raise ImportError(
ImportError: Could not import _ext module.
Please see the setup instructions in the README: https://github.com/erikwijmans/Pointnet2_PyTorch/blob/master/README.rst
然而在编辑器中,实际上我可以通过定义跳转打开pointnet2._ext文件如下:
def __bootstrap__():
global __bootstrap__, __loader__, __file__
import sys, pkg_resources, imp
__file__ = pkg_resources.resource_filename(__name__, '_ext.cpython-38-x86_64-linux-gnu.so')
__loader__ = None; del __bootstrap__, __loader__
imp.load_dynamic(__name__,__file__)
__bootstrap__()
并且该文件路径位于/usr/local/lib/python3.8/dist-packages/pointnet2-0.0.0-py3.8-linux-x86_64.egg/pointnet2/_ext.py
。
感谢您的帮助~
Hehe Fan commented
感觉应该没问题 可以用非sudo 试试么 用anaconda或virtualenv
Hehe Fan commented
或者加我微信WARush,github回复不及时。。