Closed ahchang2 closed 4 years ago
Install from the sources worked for me, follow below steps.
* $git clone https://github.com/open-mmlab/mmcv.git * $cd mmcv * $MMCV_WITH_OPS=1 python3 -m pip install -e . # package mmcv-full will be installed after this step
This fix also for me. I would add that I installed this specific version of pytorch
The key is to add MMCV_WITH_OPS=1
, so that you are installing mmcv-full
, rather than mmcv
, which has no support for GPUs.
AssertionError: active_rotated_filter_forward miss in module _ext
Traceback (most recent call last):
File "tools/train.py", line 9, in
2022-05-10:09:11:58,root ERROR [utils.py:43] active_rotated_filter_forward miss in module _ext
Traceback (most recent call last):
File "/home/data/projects/work/MMDeploy/mmdeploy/utils/utils.py", line 38, in target_wrapper
result = target(*args, *kwargs)
File "/home//data/projects/work/MMDeploy/mmdeploy/apis/pytorch2onnx.py", line 102, in torch2onnx
task_processor = build_task_processor(model_cfg, deploy_cfg, device)
File "/home/data/projects/work/MMDeploy/mmdeploy/apis/utils.py", line 21, in build_task_processor
import_codebase(codebase_type)
File "/home/data/projects/work/MMDeploy/mmdeploy/codebase/init.py", line 30, in import_codebase
importlib.import_module(f'mmdeploy.codebase.{lib}')
File "/opt/conda/lib/python3.8/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "
For people still struggling with this error:
ModuleNotFoundError: No module named 'mmcv._ext'
- It's important that pytorch - cuda - mmcv are compatible
- Therefore first you should check your cuda version
nvidia-smi
+-----------------------------------------------------------------------------+ | NVIDIA-SMI 450.102.04 Driver Version: 450.102.04 CUDA Version: 11.0 | |-------------------------------+----------------------+----------------------+
For example mine is
11.0
- Then download correct pytorch:
pip install torch==1.8.0+cu111 torchvision==0.9.0+cu111 torchaudio==0.8.0 -f https://download.pytorch.org/whl/torch_stable.html
This is Pytorch 1.8.0 with cuda 11.1.
- Install correct mmcv as they mention in their README
pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.8.0/index.html
/cu111/torch1.8.0/
see how cuda and torch versions are matching
- It should work 😃
Python 3.7.5 (default, Feb 23 2021, 13:22:40) [GCC 8.4.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from mmcv.ops import get_compiling_cuda_version, get_compiler_version >>> print(get_compiling_cuda_version()) 11.1 >>> print(get_compiler_version()) GCC 7.3 >>>
PS Here's our project where we used
mmdet
Adding to your reply: Compatibility between pytorch - mmcv - cuda for devices without a specific GPU (only CPU) also means to use the CPU-only option during installation. Installation steps varied during my project walkthrough, e.g. for mmcv installation I used
conda install pytorch torchvision cpuonly -c pytorch
instead of
conda install pytorch torchvision -c pytorch
Curious About that no one have a correct answer.
Please use:
pip uninstall mmcv-full
pip install mmcv-full --no-binary :all:
my version is 1.6.1
Curious About that no one have a correct answer.
Please use:
pip uninstall mmcv-full
pip install mmcv-full --no-binary :all:
my version is 1.6.1
Work perfectly for CPU inference.
I also meet the problem." AssertionError: MMCV==1.7.0 is used but incompatible. Please install mmcv>=1.3.2, <=1.4.0."
Same error "ModuleNotFoundError: No module named 'mmcv._ext'". I fixed it by:
I see this issue still happening I found that instead of install and then uninstall and install again, it is better to find the version that fits your machine. for example my machine uses cuda10.2 torch 1.10.0, so I found the adequate .whl here: https://download.openmmlab.com/mmcv/dist/cu102/torch1.10.0/index.html
https://mmcv.readthedocs.io/en/latest/get_started/installation.html#install-mmcv-full Install following the official doc and find the correct version works for me.
https://mmcv.readthedocs.io/en/latest/get_started/installation.html#install-mmcv-full Install following the official doc and find the correct version works for me.
afaik this is not valid in case we want mmdetection v3.0.0rc it requires mmcv v2.0.0rc
https://mmcv.readthedocs.io/en/latest/get_started/installation.html#install-mmcv-full Install following the official doc and find the correct version works for me.
This works for me as well!
I got this error with mmcv==2.0.0
. From the v2 release this is equivalent to installing the mmcv-full
package (see the release notes). So the suggestions from above are outdated.
I solved it by installing mmcv from source using
pip install --no-binary mmcv --pep517 mmcv==2.0.0
https://mmcv.readthedocs.io/en/latest/get_started/installation.html#install-mmcv-full Install following the official doc and find the correct version works for me.
What version of mmsegmentation you installed with it?
I solved this issue with
pip install mmcv-full==1.6.2 --no-cache
Looks like pip for some reason cached bad version of mmcv-full
and it blocked right installation from remote.
no-binary
This should be marked as the right answer, so it tries to install from the source. It finally solved this issue for me.
I was facing the same issue at v3.2.0 with mmcv v2.0.1 installed by mim. Managed to solve it by downgrading PyTorch to 1.13.1+cu117 and reinstalling mmcv.
mmcv is only compiled on PyTorch 1.x.0 because the compatibility usually holds between 1.x.0 and 1.x.1.
pyenv virtualenv 3.8.6 openmmlab
pyenv activate openmmlab
pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cu117
Curious About that no one have a correct answer.
Please use:
pip uninstall mmcv-full
pip install mmcv-full --no-binary :all:
my version is 1.6.1
Install from the sources worked for me, follow below steps.
* $git clone https://github.com/open-mmlab/mmcv.git * $cd mmcv * $MMCV_WITH_OPS=1 python3 -m pip install -e . # package mmcv-full will be installed after this step
Was taken so much time. I'm using colab
Install from the sources worked for me, follow below steps.
* $git clone https://github.com/open-mmlab/mmcv.git * $cd mmcv * $MMCV_WITH_OPS=1 python3 -m pip install -e . # package mmcv-full will be installed after this step
Was taken so much time. I'm using colab
Yes I still have the same issue
Well, I am on macbook pro M2 chip and none of these solutions worked for me :(
@Ishu-Kalra hey have you found any solution to this error?
@Ishu-Kalra and others who are trying to run this on an M1 / M2 / M3
Make sure you use this link to download the package specific for your system shared by @ mohdsaqibxa
Install from the sources worked for me, follow below steps.
* $git clone https://github.com/open-mmlab/mmcv.git * $cd mmcv * $MMCV_WITH_OPS=1 python3 -m pip install -e . # package mmcv-full will be installed after this step
Was taken so much time. I'm using colab
Yes I still have the same issue
I resolve this issue by following this command on Google Colab
!pip install openmim mmengine
!mim install mmcv
!rm -rf mmdetection
!git clone https://github.com/open-mmlab/mmdetection.git
%cd mmdetection
!pip install -e .
@Ishu-Kalra I encountered the issue and found a solution, on a M2 chip.
The issue: when running the verification steps for mmocr (which requires mmcv<2.2.0,>=2.0.0rc4), I got
ModuleNotFoundError: No module named 'mmcv._ext'
The solution: forcing mmcv to be installed with setup.py, by using pip<23.1 and --no-cache-dir
. The following worked:
pip install pip==23.0.1
pip install --no-cache-dir mmcv==2.0.1
Notes: worked on Python 3.10.13|3.11.7 (<3.12 needed for pip 23.0.1) and torch 2.0.1 (chosen because torch 1.13.x has a bug related to MPS).
I tried my method and it solved the problem, you can try it.
pip install -U openmim
mim install mmcv-full==1.7.0
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 dependancies.
However, it is found that the missing module mmcv._ext is a installation generated file '
Will have to see how far it holds my cause!
Update 1: when I install mmcv 1.6.0 from source with MMCV_WITH_OPS=1 & FORCE_CUDA=1, everything works good.
Still installing mmcv
was a problem for me
I'm on a linux
machine and what helped me was downgrade torch==2.2.2
to torch==2.1.0
after seeing in here
that there was no installation for torch==2.2.x
but only for torch==2.1.x
Then I've installed as they said:
pip install mmcv==2.1.0 -f https://download.openmmlab.com/mmcv/dist/cu121/torch2.1/index.html
Previous help above didn't help for me (mmcv-full
or mim install mmcv
, ...)
Hope it helps!
Curious About that no one have a correct answer.
Please use:
pip uninstall mmcv-full
pip install mmcv-full --no-binary :all:
my version is 1.6.1
Have been struggling in this problem for quite a long time, this ACTUALLY solves my problem! Many thanks!
I've been trying to fix this bug while using mmdeploy. mmdeploy requires mmcv>=2.0.0rc2 and <2.1.0 and I keep getting the no module mmcv._ext error with the allowed versions. Any updates on this issue?
@maximefuchs What's your version of pip? Have you tried the following?
pip install pip==23.0.1 pip install --no-cache-dir mmcv==2.0.1
My version of pip is 24.0 By doing what you suggested, I can't manage to install mmcv. It returns an error during the installation and fails to build the wheel:
error: command '/usr/bin/nvcc' failed with exit code 1
With pip 24.0, the installation is succesful but running the following deploy command (comes from the installation guide) gives No module named 'mmcv._ext'
:
# run the command to start model conversion
python mmdeploy/tools/deploy.py \
mmdeploy/configs/mmdet/detection/detection_tensorrt_dynamic-320x320-1344x1344.py \
mmdetection/configs/faster_rcnn/faster-rcnn_r50_fpn_1x_coco.py \
checkpoints/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth \
mmdetection/demo/demo.jpg \
--work-dir mmdeploy_model/faster-rcnn \
--device cuda \
--dump-info
mim install mmcv=='2.2.0' # just install newer version
File "xxxxxxxx/mmdetection3d/mmdet3d/__init__.py", line 21, in <module>
assert (mmcv_version >= digit_version(mmcv_minimum_version)
AssertionError: MMCV==2.2.0 is used but incompatible. Please install mmcv>=2.0.0rc4, <2.2.0.
mmdetection3d/mmdet3d/init.py
- mmcv_maximum_version = "2.2.0"
+ mmcv_maximum_version = "2.3.0" # just set any version higher than your mmcv
Hi ! Yes, I changed the minimum required version in the code and it correctly installed the library. The export is working as well. Thanks !
Le mar. 21 mai 2024 à 20:00, Allwyn Joseph @.***> a écrit :
My version of pip is 24.0 By doing what you suggested, I can't manage to install mmcv. It returns an error during the installation and fails to build the wheel:
error: command '/usr/bin/nvcc' failed with exit code 1
With pip 24.0, the installation is succesful but running the following deploy command (comes from the installation guide) gives No module named 'mmcv._ext':
run the command to start model conversion
python mmdeploy/tools/deploy.py \ mmdeploy/configs/mmdet/detection/detection_tensorrt_dynamic-320x320-1344x1344.py \ mmdetection/configs/faster_rcnn/faster-rcnn_r50_fpn_1x_coco.py \ checkpoints/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth \ mmdetection/demo/demo.jpg \ --work-dir mmdeploy_model/faster-rcnn \ --device cuda \ --dump-info
Hey maxime, Were you able to fix the issue of No module named 'mmcv._ext' ?
— Reply to this email directly, view it on GitHub https://github.com/open-mmlab/mmdetection/issues/3271#issuecomment-2123155498, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALH6AI2HN2LTXVVAWZUFQC3ZDODSVAVCNFSM4OWHCNKKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMJSGMYTKNJUHE4A . You are receiving this because you were mentioned.Message ID: @.***>
I still have the problem, i needed multiple mm*libs mmcv, mmdetection, mmclassification, mmtracking. trying to let all these work together i kept on downgrading, though everything got installed, i am still getting the same error
ModuleNotFoundError: No module named 'mmcv._ext'
following are the versions i am using: mmcv v1.3.17 mmdetection v2.14.0 mmclassification v0.19.0 mmtracking v0.8.0
cudatoolkit 11.1 cudnn 8 torch 1.8.0
i tried installing these through openmim, pip, finally had better success installing from source
install mmcv with newer version
mim install mmcv=='2.2.0' # just install newer version
version requirement
File "xxxxxxxx/mmdetection3d/mmdet3d/__init__.py", line 21, in <module> assert (mmcv_version >= digit_version(mmcv_minimum_version) AssertionError: MMCV==2.2.0 is used but incompatible. Please install mmcv>=2.0.0rc4, <2.2.0.
not recommended solution
mmdetection3d/mmdet3d/init.py
- mmcv_maximum_version = "2.2.0" + mmcv_maximum_version = "2.3.0" # just set any version higher than your mmcv
This solution is working for me on MacOS, but strangely not on Windows or Linux systems. Current Environment:
Python==3.10
Torch==2.3.1
mmdet==3.3.0
mmcv==2.2.0
These are depecndencies from the package I am building so I need to install with pip and be compatible accross different OS.. Any ideas?
Someone has already post this issue earlier, and I just wanna say I got the same issue. I'm using mmedetection on colab. I installed the program as usual, but when I tried to import inference_detector from mmdet.apis, I got the error as described in the title which I've never met before. I thought it may because some updates on your side were on progress, but I wasn't sure. Any suggestion? Thank you.