mmcv
mmcv copied to clipboard
[Bug] AssertionError: MMCV==2.2.0 is used but incompatible. Please install mmcv>=2.0.0rc4, <2.2.0.
Prerequisite
- [X] I have searched Issues and Discussions but cannot get the expected help.
- [X] The bug has not been fixed in the latest version(https://github.com/open-mmlab/mmcv).
Environment
('Python', '3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0]'),
('CUDA available', True),
('MUSA available', False),
('numpy_random_seed', 2147483648),
('GPU 0', 'NVIDIA A100-SXM4-40GB'),
('CUDA_HOME', '/usr/local/cuda'),
('NVCC', 'Cuda compilation tools, release 12.2, V12.2.140'),
('GCC', 'x86_64-linux-gnu-gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0'),
('PyTorch', '2.1.0a0+32f93b1'),
('PyTorch compiling details', 'PyTorch built with:\n - GCC 11.2\n - C++ Version: 201703\n - Intel(R) oneAPI Math Kernel Library Version 2021.1-Product Build 20201104 for Intel(R) 64 architecture applications\n - Intel(R) MKL-DNN v2.7.3 (Git Hash N/A)\n - OpenMP 201511 (a.k.a. OpenMP 4.5)\n - LAPACK is enabled (usually provided by MKL)\n - NNPACK is enabled\n - CPU capability usage: AVX2\n - CUDA Runtime 12.2\n - NVCC architecture flags: -gencode;arch=compute_52,code=sm_52;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_72,code=sm_72;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_80,code=sm_80;-gencode;arch=compute_86,code=sm_86;-gencode;arch=compute_87,code=sm_87;-gencode;arch=compute_90,code=sm_90;-gencode;arch=compute_90,code=compute_90\n - CuDNN 8.9.5\n - Magma 2.6.2\n - Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=12.2, CUDNN_VERSION=8.9.5, CXX_COMPILER=/opt/rh/gcc-toolset-11/root/usr/bin/c++, CXX_FLAGS=-fno-gnu-unique -D_GLIBCXX_USE_CXX11_ABI=1 -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOROCTRACER -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -O2 -fPIC -Wall -Wextra -Werror=return-type -Werror=non-virtual-dtor -Werror=range-loop-construct -Werror=bool-operation -Wnarrowing -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-function -Wno-unused-result -Wno-strict-overflow -Wno-strict-aliasing -Wno-stringop-overflow -Wno-psabi -Wno-error=pedantic -Wno-error=old-style-cast -Wno-invalid-partial-specialization -Wno-unused-private-field -Wno-aligned-allocation-unavailable -Wno-missing-braces -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Werror=cast-function-type -Wno-stringop-overflow, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_DISABLE_GPU_ASSERTS=ON, TORCH_VERSION=2.1.0, USE_CUDA=ON, USE_CUDNN=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=1, USE_NNPACK=ON, USE_OPENMP=ON, USE_ROCM=OFF, \n'),
('TorchVision', '0.16.0a0'),
('OpenCV', '4.7.0'),
('MMEngine', '0.10.4'),
('MMCV', '2.2.0'),
('MMCV Compiler', 'GCC 11.4'),
('MMCV CUDA Compiler', '12.2')])```
### Reproduces the problem - code sample
Installing mmcv like this
%pip install -U openmim !mim install mmengine !sed -i 's/^LayerId = cv2.dnn.DictValue/#&/' /usr/local/lib/python3.10/dist-packages/cv2/typing/init.py !mim install "mmcv>=2.1.0" %cd mmdetection %pip install -v -e . %pip install protobuf==3.20
Installs the latest version 2.2.0 since it was released yesterday
!python /home/MMDetection/mmdetection/tools/train.py
/home/MMDetection/mmdetection/configs/retinanet/retinanet_r50_fpn_1x_Headvhelmet.py
--work-dir /home/MMDetection/blablabladelete/test```
Reproduces the problem - command or script
Installing mmcv like this
%pip install -U openmim
!mim install mmengine
!sed -i 's/^LayerId = cv2.dnn.DictValue/#&/' /usr/local/lib/python3.10/dist-packages/cv2/typing/__init__.py
!mim install "mmcv>=2.1.0"
%cd mmdetection
%pip install -v -e .
%pip install protobuf==3.20
Installs the latest version 2.2.0 since it was released yesterday
!python /home/MMDetection/mmdetection/tools/train.py \
/home/MMDetection/mmdetection/configs/retinanet/retinanet_r50_fpn_1x_Headvhelmet.py \
--work-dir /home/MMDetection/blablabladelete/test```
### Reproduces the problem - error message
Traceback (most recent call last):
File "/home/MMDetection/mmdetection/tools/train.py", line 10, in
AssertionError: MMCV==2.2.0 is used but incompatible. Please install mmcv>=2.0.0rc4, <2.2.0.
### Additional information
1. For the training script from mmdetection to work.
2. Dataset not relevant
3. I think the reason might be something in the mmcv 2.2.0 version doesnt work with the train.py from mmdetection
I installed the latest version of release today
I had the same problem
Same issue. Any solution?
@DrRazadyne @solayuta For me I changed !mim install "mmcv>=2.1.0"
to !mim install "mmcv==2.1.0"
as a current solution so it doesnt install 2.2.0
pip install mmcv==2.0.0rc4
try this, in my case it got fixed
pip install mmcv==2.0.0rc4
try this, in my case it got fixed
For me this doesn't help, I get the following error by running "pip install mmcv==2.0.0rc4":
Building wheels for collected packages: mmcv
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
Building wheel for mmcv (setup.py) ... error
ERROR: Failed building wheel for mmcv
Running setup.py clean for mmcv
Failed to build mmcv
ERROR: Could not build wheels for mmcv, which is required to install pyproject.toml-based projects
Online I found a fix to install mmcv from the source but then I get the first problem again that I have version 2.2.0.
Does anyone know how to fix this?
I changed "mmdet/init.py" line9 "2.2.0" to "2.2.1" to forcely make it compatible. The demo code is ok. but I don't know whether such a modification will cause other incompatibility issues
maybe your mmdet version are too high. If you git mmdet from website, it is the latest 3.3.0. I recommend you to install mmdet==3.0.0 (https://github.com/open-mmlab/mmdetection/releases/tag/v3.0.0), then try this again pip install mmcv==2.0.0rc4
. And don't use mim to install.
I have this issue on installing mmyolo. Both mmyolo and mmcv=2.0.0 can't be installed. So I just uninstall all pakages and follow the following instruction:
just use 2.1.0 instead
Try this If you already installed it before use no cache and also ensure that you have visual studio build tools or alternative in Linux to build in your device pip install "mmcv>=2.0.0rc4,<2.2.0" --no-binary :all:
@Zhijing-W where are you getting that compatibility matrix from? The one I can see isnt right I think: https://github.com/open-mmlab/mmsegmentation/blob/main/docs/en/notes/faq.md.
Is this issue due to a recent update? What is the last stable version I can use now? Or is the library completely broken until next patch?
in my case, i comment out part of the code in mmseg/init.py from line 60 to line 62, it got fixed
@Zhijing-W where are you getting that compatibility matrix from? The one I can see isnt right I think: https://github.com/open-mmlab/mmsegmentation/blob/main/docs/en/notes/faq.md.
Is this issue due to a recent update? What is the last stable version I can use now? Or is the library completely broken until next patch?
From here: https://mmyolo.readthedocs.io/en/latest/get_started/dependencies.html. I use the version mmcv==2.0.0rc4, mmengine==0.7.1,for installing mmyolo==0.6.0. Incompatibility may caused by too high version. You can strictly follow the requirements of the compatibility matrix.
try this, in my case it got fixed
Such modification is OK and works well.
Why is this error occurring? The reason is that we have released a new version but the downstream libraries are not yet supported. There are two solutions, one is to install a lower version of mmcv (but the lower version of mmcv may not provide support for torch2.2.0), and the other is to change the mmcv version restriction in the init file of the downstream libraries, which works fine this way.
You will need to modify all c++14 to c++17 in setup.py
install the necessary development library packages on Linux using apt.
sudo apt install gcc-12
sudo apt install g++-12
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 12
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 12
gcc --version
g++ --version
export CUDA_HOME=$HOME/tools/cuda-9.0 # change to your path
export CUDA_TOOLKIT_ROOT_DIR=$CUDA_HOME
export LD_LIBRARY_PATH="$CUDA_HOME/extras/CUPTI/lib64:$LD_LIBRARY_PATH"
export LIBRARY_PATH=$CUDA_HOME/lib64:$LIBRARY_PATH
export LD_LIBRARY_PATH=$CUDA_HOME/lib64:$LD_LIBRARY_PATH
export CFLAGS="-I$CUDA_HOME/include $CFLAGS"
pip install -e .
If you are working in google colab, just run this
!pip install -U openmim
!mim install mmengine
!mim install "mmcv>=2.0.0rc4, <2.2.0."
After the first pip install for openmim, it might ask you to reset your session for colab, do that, and then re-run the same cell again, it should take around 45-60m to run the entire thing, but it should run successfully, give it a try
Change mmcv_maximum_version = '2.2.0'
to mmcv_maximum_version = '2.2.1'
and it works for me.
As @wstlxx mentioned above, if using 2.1.0 is an option for you then you can just install the version that is compatible with your pytorch and cuda version. You can find compatible versions here.
Example for cuda 12.1 and torch 2.1: pip install mmcv==2.1.0 -f https://download.openmmlab.com/mmcv/dist/cu121/torch2.1/index.html
Thanks for the suggestions! However, I tried to install with the command mim install "mmcv>=2.0.0rc4, <2.2.0."
but I get this following error. This doesn't happen when I try to install version 2.2.0. Does anyone know how to resolve this when trying to set up for MMDetection?
I am getting this error:
ImportError: /usr/local/lib/python3.8/dist-packages/mmcv/_ext.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZN3c104cuda9SetDeviceEi
@alexsuakim I think if you use the CUDA 12.0+ versions it should work fine
在我的例子中,我注释掉了 mmseg/ init.py中第 60 行到第 62 行的部分代码,问题得到了解决
i love you! you are very very handsome!
pip install mmcv-lite==2.0.0rc4
usefull for my case
thanks!this works for me!!!
thanks!this works for me!!!
THANK YOU IT WORKS FOR ME ALSO
not sure but the issue is still persisting for me,I tried ''' !pip3 install openmim !mim install mmengine !mim install "mmcv>=2.0.0,<2.1.0" ''' but it gives failed to build wheel error. if I don't put the constraints for 2.1.0,then I end up getting the same incompatible error.
pip install mmcv==2.0.0rc4
try this, in my case it got fixed
useful for me