No module named 'mmcv._ext'

14.6k views Asked by At

Tried to train the model but got the mmcv error

No module named 'mmcv._ext'

mmcv library is already installed and imported

mmcv version = 1.4.0
Cuda version = 10.0

Any suggestions to fix the issue??

4

There are 4 answers

1
Tom McLean On

https://github.com/open-mmlab/mmdetection/issues/3271

There basically are two workarounds.

Install latest mmdet and pip install mmcv-full or install pre-build ones from here.
Install mmcv==0.6.2 and mmdet==2.2.1

or try

first: pip uninstall mmcv then: pip install mmcv-full==latest+torch1.5.0+cu101 -f https://download.openmmlab.com/mmcv/dist/index.html my mmdet version is 2.4.0, mmcv>=1.1.0

0
Mohit Gaikwad On

Try

mmcv==0.6.2 and mmdet==2.3.0 this worked for me.

0
Sai Nishanth On

I have face same issue with mmcv-full [v1.6.0], mmdet [2.24.0], torch [1.9.0] + CUDA [11.1] and I cant use another version of mmcv-full due to certain dependencies. If you are stuck like me and want a very raw solution.

It is found that the missing module mmcv._ext is a installation generated file '/lib/python3.8/site-packages/mmcv/_ext.cpython-38-x86_64-linux-gnu.so'. Somehow, mmcv-full[1.6.0] pip/mim installation didn't generate me this file. So I had to install mmcv-full[1.7.2] which generated this specific _ext.cpythonblablablah file and then I copied it to mmcv-full[1.6.0] installation folder and am using it just fine.

0
Faisal Shahbaz On

Did you follow the installation guideline to install mmedit?

You can try the following steps to fix:

  1. pip uninstall mmcv-full
  2. pip install mmcv
  3. re-run this program, make sure it raise ImportError: mmcv not found
  4. reinstall mmcv-full with pip install openmim; mim install mmcv-full, or other version based on your requirements.
  5. import mmcv._ext to verify.