zju3dv / disprcnn

Code release for Stereo 3D Object Detection via Shape Prior Guided Instance Disparity Estimation (CVPR 2020, TPAMI 2021)
Apache License 2.0
213 stars 36 forks source link

ModuleNotFoundError: No module named 'disprcnn' #8

Closed QiangZiBro closed 4 years ago

QiangZiBro commented 4 years ago

In bash, I tried to run(disprcnn) ➜ disprcnn git:(master) ✗ sh scripts/train_msrcnn.sh, and got result:


*****************************************
Setting OMP_NUM_THREADS environment variable for each process to be 1 in default, to avoid your system being overloaded, please further tune the variable for optimal performance in your application as needed.
*****************************************
Traceback (most recent call last):
  File "tools/train_net.py", line 5, in <module>
Traceback (most recent call last):
  File "tools/train_net.py", line 5, in <module>
    from disprcnn.config import cfg
ModuleNotFoundError: No module named 'disprcnn'
    from disprcnn.config import cfg
ModuleNotFoundError: No module named 'disprcnn'
Traceback (most recent call last):
  File "tools/train_net.py", line 5, in <module>
    from disprcnn.config import cfg
ModuleNotFoundError: No module named 'disprcnn'
Traceback (most recent call last):
  File "/home/qiangzibro/anaconda3/envs/disprcnn/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/qiangzibro/anaconda3/envs/disprcnn/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/qiangzibro/anaconda3/envs/disprcnn/lib/python3.7/site-packages/torch/distributed/launch.py", line 246, in <module>
    main()
  File "/home/qiangzibro/anaconda3/envs/disprcnn/lib/python3.7/site-packages/torch/distributed/launch.py", line 242, in main
    cmd=cmd)
subprocess.CalledProcessError: Command '['/home/qiangzibro/anaconda3/envs/disprcnn/bin/python', '-u', 'tools/train_net.py', '--local_rank=3', '--config-file', 'configs/kitti/pob/mask.yaml']' returned non-zero exit status 1.
Traceback (most recent call last):
  File "tools/train_net.py", line 5, in <module>
    from disprcnn.config import cfg
ModuleNotFoundError: No module named 'disprcnn'
QiangZiBro commented 4 years ago

ERROR ImportError: /home/qiangzibro/disprcnn/disprcnn/_C.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _ZN2at7getTypeERK

behaviors

log

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
JiamingSuen commented 4 years ago

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.

QiangZiBro commented 4 years ago

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.

JiamingSuen commented 4 years ago
  1. What is the error message when running in bash?
  2. Which python interpreter are you using within PyCharm? The python interpreter needs to be switched to the one within the conda environment.
QiangZiBro commented 4 years ago
  1. run 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
ootts commented 4 years ago

Try to delete 'build' and 'disprcnn.egg-info' directories before you run 'sh build_and_install.sh'.