Closed QiangZiBro closed 4 years ago
ImportError: /home/qiangzibro/disprcnn/disprcnn/_C.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _ZN2at7getTypeERK
sh build_and_install.sh
passed.
├── disprcnn_R101_FPN_2d_srcnn_ckpt
│ └── srcnn_pretrained_2d_mrcnn_format.pth
└── object
├── testing
│ └── image_3
└── training
├── image_3
├── pob
└── vob
ImportError: /home/qiangzibro/disprcnn/disprcnn/_C.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _ZN2at7getTypeERK NS_6TensorE
Traceback (most recent call last):
File "/home/qiangzibro/anaconda3/envs/disprcnn/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 33
31, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-2-6034064d8a0f>", line 3, in <module>
runfile('/home/qiangzibro/disprcnn/tools/train_net.py', args=['-m', 'torch.distributed.launch', '--nproc_per_node',
'4', '-config-file', 'configs/kitti/pob/mask.yaml'], wdir='/home/qiangzibro/disprcnn')
File "/home/qiangzibro/pycharm-community-2019.1.3/helpers/pydev/_pydev_bundle/pydev_umd.py", line 197, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "/home/qiangzibro/pycharm-community-2019.1.3/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/home/qiangzibro/disprcnn/tools/train_net.py", line 6, in <module>
from disprcnn.data import make_data_loader
File "/home/qiangzibro/pycharm-community-2019.1.3/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_i
mport
module = self._system_import(name, *args, **kwargs)
File "/home/qiangzibro/disprcnn/disprcnn/data/__init__.py", line 2, in <module>
from .build import make_data_loader
File "/home/qiangzibro/pycharm-community-2019.1.3/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_i
mport
module = self._system_import(name, *args, **kwargs)
File "/home/qiangzibro/disprcnn/disprcnn/data/build.py", line 9, in <module>
from . import datasets as D
File "/home/qiangzibro/pycharm-community-2019.1.3/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_i
mport
module = self._system_import(name, *args, **kwargs)
File "/home/qiangzibro/disprcnn/disprcnn/data/datasets/__init__.py", line 2, in <module>
from .kitti_roi_dataset import KITTIRoiDataset
File "/home/qiangzibro/pycharm-community-2019.1.3/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_i
mport
module = self._system_import(name, *args, **kwargs)
File "/home/qiangzibro/disprcnn/disprcnn/data/datasets/kitti_roi_dataset.py", line 9, in <module>
from disprcnn.structures.disparity import DisparityMap
File "/home/qiangzibro/pycharm-community-2019.1.3/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_i
mport
module = self._system_import(name, *args, **kwargs)
File "/home/qiangzibro/disprcnn/disprcnn/structures/disparity.py", line 9, in <module>
from disprcnn.layers import interpolate
File "/home/qiangzibro/pycharm-community-2019.1.3/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_i
mport
module = self._system_import(name, *args, **kwargs)
File "/home/qiangzibro/disprcnn/disprcnn/layers/__init__.py", line 9, in <module>
from .nms import nms
File "/home/qiangzibro/pycharm-community-2019.1.3/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_i
mport
module = self._system_import(name, *args, **kwargs)
File "/home/qiangzibro/disprcnn/disprcnn/layers/nms.py", line 3, in <module>
from disprcnn import _C
File "/home/qiangzibro/pycharm-community-2019.1.3/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_i
mport
module = self._system_import(name, *args, **kwargs)
ImportError: /home/qiangzibro/disprcnn/disprcnn/_C.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _ZN2at7getTypeERK
NS_6TensorE
These kinds of import error are usually caused by the changing of the python environment (e.g. python/pytorch version). The cpp/cuda extensions defined in _C.cpython-37m-x86_64-linux-gnu.so
must be recompiled in the case of environment change.
Please make sure that you have followed the exact installation steps in the documentation and recompile those modules.
Thank you for reply! I notice that the two main installation steps
conda env create -f environment.yaml
conda activate disprcnn
sh build_and_install.sh
I executed commands in the script build_and_install.sh
step by step and all have passed, but still got problem in _C.cpython-37m-x86_64-linux-gnu.so
.
python setup.py build develop
of build_and_install.sh
3 errors occured
/usr/bin/nvcc -DWITH_CUDA -I/home/qiangzibro/disprcnn/disprcnn/csrc -I/home/qiangzibro/anaconda3/envs/disprcnn/lib/pyth
on3.7/site-packages/torch/include -I/home/qiangzibro/anaconda3/envs/disprcnn/lib/python3.7/s
ite-packages/torch/include/torch/csrc/api/include -I/home/qiangzibro/anaconda3/envs/disprcnn/lib/python3.7/site-package
s/torch/include/TH -I/home/qiangzibro/anaconda3/envs/disprcnn/lib/python3.7/site-packages/to
rch/include/THC -I/home/qiangzibro/anaconda3/envs/disprcnn/include/python3.7m -c /home/qiangzibro/disprcnn/disprcnn/csr
c/cuda/nms.cu -o build/temp.linux-x86_64-3.7/home/qiangzibro/disprcnn/disprcnn/csrc/cuda/nms
.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -
-compiler-options '-fPIC' -DCUDA_HAS_FP16=1 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HAL
F2_OPERATORS__ -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=1 -std=c++11
/usr/lib/gcc/x86_64-linux-gnu/5/include/mwaitxintrin.h(36): error: identifier "__builtin_ia32_monitorx" is undefined
/usr/lib/gcc/x86_64-linux-gnu/5/include/mwaitxintrin.h(42): error: identifier "__builtin_ia32_mwaitx" is undefined
/home/qiangzibro/anaconda3/envs/disprcnn/lib/python3.7/site-packages/torch/include/c10/util/Half-inl.h(21): error: iden tifier "__half_as_short" is undefined
3 errors detected in the compilation of "/tmp/tmpxft_00002ed3_00000000-7_nms.cpp1.ii".
I tried to add
"-D_MWAITXINTRIN_H_INCLUDED",
"-D__STRICT_ANSI__",
in `setup.py`
and **3 errors reduced to 1:**
/home/qiangzibro/anaconda3/envs/disprcnn/lib/python3.7/site-packages/torch/include/c10/util/Half-inl.h(21): error: identifier "__half_as_short" is undefined
1 error detected in the compilation of "/tmp/tmpxft_00004427_00000000-7_nms.cpp1.ii". error: command '/usr/bin/nvcc' failed with exit status 2
I'm trying to fix last error
2. In pycharm, I use python interpreter generated by `conda env create -f environment.yaml`
My Computer Environment:
- CUDA Version 10.0.130
- CUDNN 7
- Ubuntu16
Try to delete 'build' and 'disprcnn.egg-info' directories before you run 'sh build_and_install.sh'.
In bash, I tried to run
(disprcnn) ➜ disprcnn git:(master) ✗ sh scripts/train_msrcnn.sh
, and got result: