from mmcv import Config, D" /> from mmcv import Config, D" /> from mmcv import Config, D"/>

Cannot import name 'Config' from 'mmcv' (unknown location)

8.7k Views Asked by At

When I install mmcv-full, then python train.py

Traceback (most recent call last):
  File "tools/test.py", line 8, in <module>
    from mmcv import Config, DictAction
ImportError: cannot import name 'Config' from 'mmcv' (unknown location)

No matter if I download mmcv or mmcv-full it doesn't solve the problem.

1

There are 1 best solutions below

0
teejk On

Config has been moved to mmengine in mmcv 2.0.0. https://github.com/open-mmlab/mmcv/issues/2757

You can import using:

from mmengine.config import Config

Note that as of right now, configs from mmcv <2.0.0 need to be migrated and their tutorials have not been updated in the mmedetection package. So, if you are following those tutorials using Config, you will need to also follow the migration guide:

https://mmdetection.readthedocs.io/en/latest/migration/config_migration.html