#3096·mmcv

[Bug] AssertionError: MMCV==2.2.0 is used but incompatible. Please install mmcv>=2.0.0rc4, <2.2.0.

Author: GrushusCreated Apr 25, 2024Updated Mar 22, 2026

Prerequisite

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

bash
!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 from mmdet.utils import setup_cache_size_limit_of_dynamo File "/home/MMDetection/mmdetection/mmdet/init.py", line 17, in and mmcv_version < digit_version(mmcv_maximum_version)),
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