open-mmlab / mmocr

OpenMMLab Text Detection, Recognition and Understanding Toolbox
https://mmocr.readthedocs.io/en/dev-1.x/
Apache License 2.0
4.3k stars 745 forks source link

[Bug] MMCV==2.1.0 is used but incompatible. Please install mmcv>=2.0.0rc4, <2.1.0. #2024

Open pure-wei opened 7 months ago

pure-wei commented 7 months ago

Prerequisite

Task

I'm using the official example scripts/configs for the officially supported tasks/models/datasets.

Branch

main branch https://github.com/open-mmlab/mmocr

Environment

python 3.11.5 pytorch 2.1.2 cuda 12.1

Reproduces the problem - code sample

!pip install -U openmim !pip install opencv-python pillow matplotlib seaborn tqdm -i https://pypi.tuna.tsinghua.edu.cn/simple !git clone https://github.com/open-mmlab/mmocr.git !mim install -e . import mmocr

print(dir(mmocr)) print(dir(mmcv))

AssertionError Traceback (most recent call last) Cell In[7], line 2 1 # 检查 mmocr ----> 2 import mmocr 3 #print('mmocr版本', mmocr.version) 4 print(dir(mmocr))

File c:\Users\rhwto\Desktop\code\github\MMOCR_tutorials-main\20230620\mmocr\mmocr__init__.py:4 1 # Copyright (c) OpenMMLab. All rights reserved. 3 import mmcv ----> 4 import mmdet 6 try: 7 import mmengine

File c:\Users\rhwto\anaconda3\Lib\site-packages\mmdet__init__.py:17 13 mmengine_maximum_version = '1.0.0' 14 mmengine_version = digit_version(mmengine.version) 16 assert (mmcv_version >= digit_version(mmcv_minimum_version) ---> 17 and mmcv_version < digit_version(mmcv_maximum_version)), \ 18 f'MMCV=={mmcv.version} is used but incompatible. ' \ 19 f'Please install mmcv>={mmcv_minimum_version}, <{mmcv_maximum_version}.' 21 assert (mmengine_version >= digit_version(mmengine_minimum_version) 22 and mmengine_version < digit_version(mmengine_maximum_version)), \ 23 f'MMEngine=={mmengine.version} is used but incompatible. ' \ 24 f'Please install mmengine>={mmengine_minimum_version}, ' \ 25 f'<{mmengine_maximum_version}.' 27 all = ['version', 'version_info', 'digit_version']

AssertionError: MMCV==2.1.0 is used but incompatible. Please install mmcv>=2.0.0rc4, <2.1.0.

Reproduces the problem - command or script


AssertionError Traceback (most recent call last) Cell In[7], line 2 1 # 检查 mmocr ----> 2 import mmocr 3 #print('mmocr版本', mmocr.version) 4 print(dir(mmocr))

File c:\Users\rhwto\Desktop\code\github\MMOCR_tutorials-main\20230620\mmocr\mmocr__init__.py:4 1 # Copyright (c) OpenMMLab. All rights reserved. 3 import mmcv ----> 4 import mmdet 6 try: 7 import mmengine

File c:\Users\rhwto\anaconda3\Lib\site-packages\mmdet__init__.py:17 13 mmengine_maximum_version = '1.0.0' 14 mmengine_version = digit_version(mmengine.version) 16 assert (mmcv_version >= digit_version(mmcv_minimum_version) ---> 17 and mmcv_version < digit_version(mmcv_maximum_version)), \ 18 f'MMCV=={mmcv.version} is used but incompatible. ' \ 19 f'Please install mmcv>={mmcv_minimum_version}, <{mmcv_maximum_version}.' 21 assert (mmengine_version >= digit_version(mmengine_minimum_version) 22 and mmengine_version < digit_version(mmengine_maximum_version)), \ 23 f'MMEngine=={mmengine.version} is used but incompatible. ' \ 24 f'Please install mmengine>={mmengine_minimum_version}, ' \ 25 f'<{mmengine_maximum_version}.' 27 all = ['version', 'version_info', 'digit_version']

AssertionError: MMCV==2.1.0 is used but incompatible. Please install mmcv>=2.0.0rc4, <2.1.0.

Reproduces the problem - error message


AssertionError Traceback (most recent call last) Cell In[7], line 2 1 # 检查 mmocr ----> 2 import mmocr 3 #print('mmocr版本', mmocr.version) 4 print(dir(mmocr))

File c:\Users\rhwto\Desktop\code\github\MMOCR_tutorials-main\20230620\mmocr\mmocr__init__.py:4 1 # Copyright (c) OpenMMLab. All rights reserved. 3 import mmcv ----> 4 import mmdet 6 try: 7 import mmengine

File c:\Users\rhwto\anaconda3\Lib\site-packages\mmdet__init__.py:17 13 mmengine_maximum_version = '1.0.0' 14 mmengine_version = digit_version(mmengine.version) 16 assert (mmcv_version >= digit_version(mmcv_minimum_version) ---> 17 and mmcv_version < digit_version(mmcv_maximum_version)), \ 18 f'MMCV=={mmcv.version} is used but incompatible. ' \ 19 f'Please install mmcv>={mmcv_minimum_version}, <{mmcv_maximum_version}.' 21 assert (mmengine_version >= digit_version(mmengine_minimum_version) 22 and mmengine_version < digit_version(mmengine_maximum_version)), \ 23 f'MMEngine=={mmengine.version} is used but incompatible. ' \ 24 f'Please install mmengine>={mmengine_minimum_version}, ' \ 25 f'<{mmengine_maximum_version}.' 27 all = ['version', 'version_info', 'digit_version']

AssertionError: MMCV==2.1.0 is used but incompatible. Please install mmcv>=2.0.0rc4, <2.1.0.

Additional information

please fix the error with cuda file,and i can't find the preciously compatible version that works

yechaoying commented 7 months ago

I uninstalled mmcv==2.1.0 and installed mmcv==2.0.0 as the AssertionError said. But after "import mmselfsup", there are"UserWarning: Cannot import torch.fx, merge_dict is a simple function to merge multiple dicts".

d9j commented 6 months ago

this project appears to be not maintained well.. it requires deprecated python 3.8 which been dropped even by anaconda.

DeShinHwa commented 5 months ago

Hi, did u solve it ?

zhouzaida commented 5 months ago

Hi, you could try to uninstall mmcv and install mmcv==2.0.0 via mim install mmcv==2.0.0.

MiXaiLL76 commented 5 months ago

https://github.com/MiXaiLL76/mmocr/commit/922bc3237cb25a52af1ccadd3542efe61f1a6ac6

Do something like this

@zhouzaida When will there be an update with the latest dependencies? Maybe it's worth going with the correct format and specifying dependencies in the installation files?

But it turns out that they are right in init.py, which doesn’t look very good

Yoanes-Yeo commented 5 months ago

I've tried everything that i can, I still having the issue same like this... ' 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'

DeShinHwa commented 5 months ago

I've tried everything that i can, I still having the issue same like this... ' 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'

If your pytorch version is 2.1.0, cuda 12.1. U can use this code below to install the specify version of the mmcv. It works for me. pip install mmcv==2.1.0 -f https://download.openmmlab.com/mmcv/dist/cu121/torch2.1/index.html

MiXaiLL76 commented 5 months ago

fixed with https://github.com/open-mmlab/mmocr/pull/2023

install from git

drzraf commented 5 months ago

see also https://github.com/open-mmlab/mmocr/issues/2041