Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows下mmcv中importlib.import_module('mmcv.'_ext )报错ImportError: DLL load failed: 找不到指定的模块。 #1569

Closed
mortal-Zero opened this issue Dec 8, 2021 · 18 comments

Comments

@mortal-Zero
Copy link

version:
Windows 10
VS2015
cuda 10.1
python 3.7
pytorch 1.6.0
torchvision 0.7.0
mmcv 1.4.0
mmdetection 2.18.0
mmocr 0.3.0
(There are no errors in install mmcv, build mmdet, build mmocr)


when i tried to train the maskrcnn for textdet from mmocr, but i got this ImportError.

cmd: python tools/train.py configs/textdet/maskrcnn/mask_rcnn_r50_fpn_160e_icdar2017.py

details: Traceback (most recent call last):
File "tools/train.py", line 17, in
from mmocr.apis import train_detector
File "e:\mmlab\mmocr-0.3.0\mmocr\apis_init_.py", line 2, in
from .inference import init_detector, model_inference
File "e:\mmlab\mmocr-0.3.0\mmocr\apis\inference.py", line 7, in
from mmcv.ops import RoIPool
File "D:\Miniconda3\envs\mmlab\lib\site-packages\mmcv\ops_init_.py", line 2, in
from .assign_score_withk import assign_score_withk
File "D:\Miniconda3\envs\mmlab\lib\site-packages\mmcv\ops\assign_score_withk.py", line 6, in
'ext', ['assign_score_withk_forward', 'assign_score_withk_backward'])
File "D:\Miniconda3\envs\mmlab\lib\site-packages\mmcv\utils\ext_loader.py", line 14, in load_ext
ext = importlib.import_module('mmcv.' + name)
File "D:\Miniconda3\envs\mmlab\lib\importlib_init
.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: DLL load failed: 找不到指定的模块。


and i tried again in mmdet, train maskrcnn, got this Error again.

cmd: python tools/train.py configs\mask_rcnn\mask_rcnn_r50_fpn_1x_coco.py

Traceback (most recent call last):
File "tools/train.py", line 16, in
from mmdet.apis import set_random_seed, train_detector
File "e:\mmlab\mmdetection-2.18.0\mmdet\apis_init_.py", line 2, in
from .inference import (async_inference_detector, inference_detector,
File "e:\mmlab\mmdetection-2.18.0\mmdet\apis\inference.py", line 7, in
from mmcv.ops import RoIPool
File "D:\Miniconda3\envs\mmlab\lib\site-packages\mmcv\ops_init_.py", line 2, in
from .assign_score_withk import assign_score_withk
File "D:\Miniconda3\envs\mmlab\lib\site-packages\mmcv\ops\assign_score_withk.py", line 6, in
'ext', ['assign_score_withk_forward', 'assign_score_withk_backward'])
File "D:\Miniconda3\envs\mmlab\lib\site-packages\mmcv\utils\ext_loader.py", line 14, in load_ext
ext = importlib.import_module('mmcv.' + name)
File "D:\Miniconda3\envs\mmlab\lib\importlib_init
.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: DLL load failed: 找不到指定的模块。

@zhouzaida
Copy link
Member

It seems like that you do not install mmcv-full. Please provide the output of pip list.

@mortal-Zero
Copy link
Author

It seems like that you do not install mmcv-full. Please provide the output of pip list.

this is the pip list:

Package Version Location


addict 2.4.0
asynctest 0.13.0
atomicwrites 1.4.0
attrs 21.2.0
autopep8 1.5.7
certifi 2021.10.8
charset-normalizer 2.0.9
codecov 2.1.12
colorama 0.4.4
coverage 6.2
cycler 0.11.0
Cython 0.29.25
flake8 4.0.1
fonttools 4.28.3
future 0.18.2
idna 3.3
imageio 2.13.2
imgaug 0.4.0
importlib-metadata 4.2.0
importlib-resources 5.4.0
iniconfig 1.1.1
isort 5.10.1
jaraco.classes 3.2.1
jaraco.collections 3.4.0
jaraco.functools 3.4.0
jaraco.structures 2.1.0
jaraco.text 3.6.0
jaraco.ui 2.3.0
jaraco.windows 5.7.0
kiwisolver 1.3.2
kwarray 0.5.21
lanms-neo 1.0.2
llvmlite 0.37.0
lmdb 1.2.1
matplotlib 3.5.0
mccabe 0.6.1
mkl-fft 1.3.1
mkl-random 1.2.2
mkl-service 2.4.0
mmcv-full 1.4.0
mmdet 2.18.0 e:\mmlab\mmdetection-2.18.0
mmocr 0.3.0 e:\mmlab\mmocr-0.3.0
more-itertools 8.12.0
networkx 2.6.3
numba 0.54.1
numpy 1.20.3
olefile 0.46
opencv-python 4.5.4.60
ordered-set 4.0.2
packaging 21.3
path 16.2.0
Pillow 8.4.0
pip 21.2.4
pluggy 1.0.0
py 1.11.0
pyclipper 1.3.0.post2
pycocotools-windows 2.0.0.2
pycodestyle 2.8.0
pyflakes 2.4.0
pyparsing 3.0.6
pytest 6.2.5
pytest-cov 3.0.0
pytest-runner 5.3.1
python-dateutil 2.8.2
PyWavelets 1.2.0
PyYAML 6.0
rapidfuzz 1.8.3
regex 2021.11.10
requests 2.26.0
scikit-image 0.19.0
scipy 1.7.3
setuptools 58.0.4
setuptools-scm 6.3.2
Shapely 1.8.0
six 1.16.0
terminaltables 3.1.10
tifffile 2021.11.2
toml 0.10.2
tomli 1.2.2
torch 1.6.0
torchvision 0.7.0
typing_extensions 4.0.1
ubelt 0.10.2
urllib3 1.26.7
wheel 0.37.0
wincertstore 0.2
xdoctest 0.15.10
yapf 0.31.0
zipp 3.6.0

@zhouzaida
Copy link
Member

What command did you use to install mmcv-full?

@mortal-Zero
Copy link
Author

What command did you use to install mmcv-full?

pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.10.0/index.html

It comes from OpenMMLab知乎(https://zhuanlan.zhihu.com/p/441653536)

@zhouzaida
Copy link
Member

What is your python version?

@mortal-Zero
Copy link
Author

What is your python version?

python3.7 from miniconda

@mortal-Zero
Copy link
Author

mortal-Zero commented Dec 9, 2021

What is your python version?

conda create -n mmlab python=3.7 -y 
conda activate mmlab 
 
conda install pytorch==1.6.0 torchvision==0.7.0 cudatoolkit=10.1 -c pytorch -y 
# install the latest mmcv 
pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.10.0/index.html 

# install mmdetection 
cd mmdetection-2.18.0
pip install -r requirements/build.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install -v -e . 

# install mmocr 
cd mmdetection-0.3.0
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install -v -e . 

I installed my environment using these commands.

@zhouzaida
Copy link
Member

Ok, thanks for your report. I will try to re-produce the exception.

@mortal-Zero
Copy link
Author

Ok, thanks for your report. I will try to re-produce the exception.

Also thank you very much for your help.

@zhouzaida
Copy link
Member

What is your python version?

conda create -n mmlab python=3.7 -y 
conda activate mmlab 
 
conda install pytorch==1.6.0 torchvision==0.7.0 cudatoolkit=10.1 -c pytorch -y 
# install the latest mmcv 
pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.10.0/index.html 

# install mmdetection 
cd mmdetection-2.18.0
pip install -r requirements/build.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install -v -e . 

# install mmocr 
cd mmdetection-0.3.0
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install -v -e . 

I installed my environment using these commands.

Hi @Baiyixuan1113 , there are several inconsistencies

  • You installed the torch1.6.0 but installed mmcv-full built in torch1.10.0
  • You installed the torch1.6.0 built in cuda10.1 but installed mmcv-full built in cuda10.2

@mortal-Zero
Copy link
Author

What is your python version?

conda create -n mmlab python=3.7 -y 
conda activate mmlab 
 
conda install pytorch==1.6.0 torchvision==0.7.0 cudatoolkit=10.1 -c pytorch -y 
# install the latest mmcv 
pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.10.0/index.html 

# install mmdetection 
cd mmdetection-2.18.0
pip install -r requirements/build.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install -v -e . 

# install mmocr 
cd mmdetection-0.3.0
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install -v -e . 

I installed my environment using these commands.

Hi @Baiyixuan1113 , there are several inconsistencies

  • You installed the torch1.6.0 but installed mmcv-full built in torch1.10.0
  • You installed the torch1.6.0 built in cuda10.1 but installed mmcv-full built in cuda10.2

Ok, I will try again according to the version you provided.

@zhouzaida
Copy link
Member

zhouzaida commented Dec 13, 2021

The correct command to install mmcv-full is pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.6.0/index.html

@mortal-Zero
Copy link
Author

Correct command to install mmcv-full pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.6.0/index.html

Sorry for the late reply. I adjusted mmcv-full according to the method you said, and it worked.

@123456klk1
Copy link

What is your python version?

Will python version 3.6 have any impact?

@zhouzaida
Copy link
Member

Hi @123456klk1 , did you meet the same error?

@wen0418
Copy link

wen0418 commented Feb 13, 2023

i met the same error, can you help me? @zhouzaida

@gmy-gm
Copy link

gmy-gm commented Apr 18, 2023

@wen0418 hello,I don't know if you have solved the error. I met the same error when I install mmcv. I search the solution and find it. I hope it can help you if you have not solved the error. I use python3.8 pillow 9.3.0, but python3.8 should use 6.2.1. I use "pip uninstall pillow" and "pip install pillow==6.2.1" solve the question.

@Zhijing-W
Copy link

@zhouzaida ,Hi, I have smae issues. Can you check my version is appropriate or not? Thank you in advance.
71b6d203f02a9f36f1b35d62afb79ce

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants