open-mmlab / mmsegmentation

OpenMMLab Semantic Segmentation Toolbox and Benchmark.
https://mmsegmentation.readthedocs.io/en/main/
Apache License 2.0
7.99k stars 2.57k forks source link

Incompatible with MMCV 2.2.0 #3729

Open KitakazePOI opened 2 months ago

KitakazePOI commented 2 months ago

Hi, I installed mmcv and mmseg from source and both said installed successfully. When run the demo, it reported:

Traceback (most recent call last): File "demo/image_demo.py", line 6, in <module> from mmseg.apis import inference_model, init_model, show_result_pyplot File "/home/qrx/proj/mmsegmentation/mmseg/__init__.py", line 61, in <module> assert (mmcv_min_version <= mmcv_version < mmcv_max_version), \ AssertionError: MMCV==2.2.0 is used but incompatible. Please install mmcv>=2.0.0rc4.

Environment information:

sys.platform: linux Python: 3.8.10 (default, Nov 22 2023, 10:22:35) [GCC 9.4.0] CUDA available: True MUSA available: False numpy_random_seed: 2147483648 GPU 0: NVIDIA GeForce RTX 3050 Laptop GPU CUDA_HOME: /usr/local/cuda NVCC: Cuda compilation tools, release 12.4, V12.4.131 GCC: x86_64-linux-gnu-gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0 PyTorch: 2.3.0+cu121 PyTorch compiling details: PyTorch built with:

OpenCV: 4.10.0 MMEngine: 0.10.4 MMCV: 2.2.0 MMCV Compiler: GCC 9.4 MMCV CUDA Compiler: 12.4

singer0730 commented 2 months ago

I have the same issue,....Incompatible with MMCV 2.2.0

yyxxiiaaoo commented 2 months ago

if your cuda version is 11.1 and torch is 1.10.x pip install mmcv==2.0.0 -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.10/index.html it works

yifanlu0227 commented 2 months ago

Edit the __init__.py for mmseg (<PYTHON_DIR>/site-packages/mmseg/__init__.py) and remove the mmcv_max_version requirment.

assert (mmcv_min_version <= mmcv_version < mmcv_max_version), \
    f'MMCV=={mmcv.__version__} is used but incompatible. ' \
    f'Please install mmcv>=2.0.0rc4.'

to

assert (mmcv_min_version <= mmcv_version, \
    f'MMCV=={mmcv.__version__} is used but incompatible. ' \
    f'Please install mmcv>=2.0.0rc4.'
bgpantojar commented 1 month ago

I had this problem: https://github.com/open-mmlab/mmcv/issues/1386

I managed to install mmcv two ways:

1 - pip install mmcv==2.2.0 -f https://download.openmmlab.com/mmcv/dist/cu121/torch2.3/index.html 2 - buidling from the source as https://mmcv.readthedocs.io/en/latest/get_started/build.html

Unfortunatelly when runing the demo: python demo/image_demo.py demo/demo.png configs/pspnet/pspnet_r50-d8_4xb2-40k_cityscapes-512x1024.py pspnet_r50-d8_512x1024_40k_cityscapes_20200605_003338-2966598c.pth --device cuda:0 --out-file result.jpg

It shows AssertionError: MMCV==2.2.0 is used but incompatible. Please install mmcv>=2.0.0rc4.

Then again, if I try to install the version 2.0.0rc4, with pip or mim, it takes forever the wheel building.

Runing on Windows 11, my cuda is 12.4 and my pytorch 2.4.0. I am guessing that my problems are related to these versions of cuda and pytorch.

Is there a solution for this?

wsqstar commented 2 weeks ago

I had this problem: open-mmlab/mmcv#1386

I managed to install mmcv two ways:

1 - pip install mmcv==2.2.0 -f https://download.openmmlab.com/mmcv/dist/cu121/torch2.3/index.html 2 - buidling from the source as https://mmcv.readthedocs.io/en/latest/get_started/build.html

Unfortunatelly when runing the demo: python demo/image_demo.py demo/demo.png configs/pspnet/pspnet_r50-d8_4xb2-40k_cityscapes-512x1024.py pspnet_r50-d8_512x1024_40k_cityscapes_20200605_003338-2966598c.pth --device cuda:0 --out-file result.jpg

It shows AssertionError: MMCV==2.2.0 is used but incompatible. Please install mmcv>=2.0.0rc4.

Then again, if I try to install the version 2.0.0rc4, with pip or mim, it takes forever the wheel building.

Runing on Windows 11, my cuda is 12.4 and my pytorch 2.4.0. I am guessing that my problems are related to these versions of cuda and pytorch.

Is there a solution for this?

I hope this works for you https://mmcv.readthedocs.io/en/latest/get_started/installation.html