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

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

Open
2 tasks done
Grushus opened this issue Apr 25, 2024 · 15 comments

Comments

@Grushus
Copy link

Grushus commented Apr 25, 2024

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

!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
@solayuta
Copy link

I installed the latest version of release today

I had the same problem

@DrRazadyne
Copy link

Same issue. Any solution?

@Grushus
Copy link
Author

Grushus commented Apr 29, 2024

@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

@ashishnex007
Copy link

pip install mmcv==2.0.0rc4

try this, in my case it got fixed

@HuysArthur
Copy link

HuysArthur commented May 2, 2024

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?

@Cannol
Copy link

Cannol commented May 4, 2024

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

@Zhijing-W
Copy link

Zhijing-W commented May 7, 2024

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.

@Zhijing-W
Copy link

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:
image

@wstlxx
Copy link

wstlxx commented May 8, 2024

just use 2.1.0 instead

@MostafaKamalEid
Copy link

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:

@ArenaGrenade
Copy link

@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?

@uptownfunkmars
Copy link

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
Copy link

@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.

@zhouzaida
Copy link
Member

try this, in my case it got fixed

Such modification is OK and works well.

@zhouzaida
Copy link
Member

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.

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