FangyunWei / SLRT

236 stars 46 forks source link

ModuleNotFoundError: No module named 'mmcv._ext' #35

Closed fransisca25 closed 10 months ago

fransisca25 commented 10 months ago

I attempted to use Docker, but I couldn't find the SLRT file within the workspace. To resolve this, I cloned the repository from GitHub myself. I then verified the CUDA version using the command 'nvcc --version,' which indicated CUDA version 11.3. It appears that this version is not compatible with Torch 1.9.0+cu102. Also the docker container use python 3.9 but I think it is better to use python 3.8 and conda environment, so I made a conda environment inside the docker container with python 3.8 as default.

Below I've provided the current versions of the software I'm using:

- python: 3.8.18
- torch: 1.12.0+cu113
- torchvision: 0.13.0+cu113
- mmcv: 1.4.8
- mmdet: 2.23.0
- mmpose: 0.26.0
- numpy 1.24.4

I attempted to run 'gen_pose.py' and encountered the following error:

Traceback (most recent call last): File "gen_pose.py", line 36, in from mmdet.apis import inference_detector, init_detector File "/workspace/mmdetection/mmdet/apis/init.py", line 2, in from .inference import (async_inference_detector, inference_detector, File "/workspace/mmdetection/mmdet/apis/inference.py", line 7, in from mmcv.ops import RoIPool File "/workspace/mmcv/mmcv/ops/init.py", line 2, in from .active_rotated_filter import active_rotated_filter File "/workspace/mmcv/mmcv/ops/active_rotated_filter.py", line 8, in ext_module = ext_loader.load_ext( File "/workspace/mmcv/mmcv/utils/ext_loader.py", line 13, in load_ext ext = importlib.import_module('mmcv.' + name) File "/root/miniconda3/envs/islr2/lib/python3.8/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) ModuleNotFoundError: No module named 'mmcv._ext'

Could you please assist me in troubleshooting this error? I'm currently stuck and I really need your guidance. Thank you

2000ZRL commented 10 months ago

I think it is caused by the conflict between cuda version and mmcv version. I suggest you reinstall mmcv/mmpose/mmdet to be compatible with your current CUDA version. You may refer to corresponding github repo for instructions.

ZechengLi19 commented 10 months ago

I attempted to use Docker, but I couldn't find the SLRT file within the workspace. To resolve this, I cloned the repository from GitHub myself. I then verified the CUDA version using the command 'nvcc --version,' which indicated CUDA version 11.3. It appears that this version is not compatible with Torch 1.9.0+cu102. Also the docker container use python 3.9 but I think it is better to use python 3.8 and conda environment, so I made a conda environment inside the docker container with python 3.8 as default.

Below I've provided the current versions of the software I'm using:

- python: 3.8.18
- torch: 1.12.0+cu113
- torchvision: 0.13.0+cu113
- mmcv: 1.4.8
- mmdet: 2.23.0
- mmpose: 0.26.0
- numpy 1.24.4

I attempted to run 'gen_pose.py' and encountered the following error:

Traceback (most recent call last): File "gen_pose.py", line 36, in from mmdet.apis import inference_detector, init_detector File "/workspace/mmdetection/mmdet/apis/init.py", line 2, in from .inference import (async_inference_detector, inference_detector, File "/workspace/mmdetection/mmdet/apis/inference.py", line 7, in from mmcv.ops import RoIPool File "/workspace/mmcv/mmcv/ops/init.py", line 2, in from .active_rotated_filter import active_rotated_filter File "/workspace/mmcv/mmcv/ops/active_rotated_filter.py", line 8, in ext_module = ext_loader.load_ext( File "/workspace/mmcv/mmcv/utils/ext_loader.py", line 13, in load_ext ext = importlib.import_module('mmcv.' + name) File "/root/miniconda3/envs/islr2/lib/python3.8/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) ModuleNotFoundError: No module named 'mmcv._ext'

Could you please assist me in troubleshooting this error? I'm currently stuck and I really need your guidance. Thank you

Install mmcv-full instead of mmcv. like: pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.10.0/index.html

I use torch 1.10.0+cu113. so, I place 'cu113/torch1.10.0' into the url. You can change it to your own version.

fransisca25 commented 10 months ago

Thank you for the responses! I am able to resolve the problem by installing mmcv-full.