open-mmlab / mmcv

OpenMMLab Computer Vision Foundation
https://mmcv.readthedocs.io/en/latest/
Apache License 2.0
5.9k stars 1.65k forks source link

ImportError: cannot import name 'TORCH_VERSION' from 'mmcv.utils' (C:\Users\hongzheng\.conda\envs\opencd\lib\site-packages\mmcv\utils\__init__.py)[Docs] #2984

Open HZWXW371 opened 1 year ago

HZWXW371 commented 1 year ago

📚 The doc issue

Traceback (most recent call last): File "D:\GIS\LightCDNet-main\tools\train.py", line 15, in from mmcv.runner import get_dist_info, init_dist File "C:\Users\hongzheng.conda\envs\opencd\lib\site-packages\mmcv\runner__init.py", line 3, in from .base_runner import BaseRunner File "C:\Users\hongzheng.conda\envs\opencd\lib\site-packages\mmcv\runner\base_runner.py", line 16, in from ..parallel import is_module_wrapper File "C:\Users\hongzheng.conda\envs\opencd\lib\site-packages\mmcv\parallel__init__.py", line 5, in from .distributed import MMDistributedDataParallel File "C:\Users\hongzheng.conda\envs\opencd\lib\site-packages\mmcv\parallel\distributed.py", line 10, in from mmcv.utils import TORCH_VERSION, digit_version ImportError: cannot import name 'TORCH_VERSION' from 'mmcv.utils' (C:\Users\hongzheng.conda\envs\opencd\lib\site-packages\mmcv\utils\init__.py)

Process finished with exit code 1

Suggest a potential alternative/fix

Traceback (most recent call last): File "D:\GIS\LightCDNet-main\tools\train.py", line 15, in from mmcv.runner import get_dist_info, init_dist File "C:\Users\hongzheng.conda\envs\opencd\lib\site-packages\mmcv\runner__init.py", line 3, in from .base_runner import BaseRunner File "C:\Users\hongzheng.conda\envs\opencd\lib\site-packages\mmcv\runner\base_runner.py", line 16, in from ..parallel import is_module_wrapper File "C:\Users\hongzheng.conda\envs\opencd\lib\site-packages\mmcv\parallel__init__.py", line 5, in from .distributed import MMDistributedDataParallel File "C:\Users\hongzheng.conda\envs\opencd\lib\site-packages\mmcv\parallel\distributed.py", line 10, in from mmcv.utils import TORCH_VERSION, digit_version ImportError: cannot import name 'TORCH_VERSION' from 'mmcv.utils' (C:\Users\hongzheng.conda\envs\opencd\lib\site-packages\mmcv\utils\init__.py)

Process finished with exit code 1

Ritesh261 commented 11 months ago

could resolve this issues ?.

zhouzaida commented 10 months ago

Hi, what is your mmcv version?

tanatomoe commented 10 months ago

Did you manage to fix this issue?

Manishnayak234 commented 9 months ago

hey anybody solved this issue ?

vetsasai commented 9 months ago

from mmengine.utils.dl_utils import TORCH_VERSION

This worked for me

CoffeeinTeaC commented 3 months ago

than i meet a problem as follows: ImportError: cannot import name 'digit_version' from 'mmcv.utils' (/home/cyg/anaconda3/envs/tinydet/lib/python3.8/site-packages/mmcv/utils/init.py)

smolan commented 2 months ago

from mmengine.utils.dl_utils import TORCH_VERSION from mmengine.utils import digit_version