download function in openmim.commands.download module cannot find config file
Hello @zhouzaida, @ZwwWayne ,
steps to reproduce:
- install mmdet, mmcv-full and mim via pip:
pip install -U mmdet mmcv-full mim==0.1.2
- or install mmdet via mim:
mim install mmdet
- then call download function from mim:
from openmim.commands.download import download
download(package="mmdet", configs=['cascade_mask_rcnn_r50_fpn_1x_coco'])
error:
Exception has occurred: ValueError (note: full exception trace is shown but execution is paused at: _run_module_as_main)
[31m[1mlib/python3.8/site-packages/mmdet/configs/cascade_rcnn/cascade_mask_rcnn_r50_fpn_1x_coco.py is not found.[0m
File "xxx.py", line 79, in download
raise ValueError(highlighted_error(f"{config_path} is not found."))
reason:
this line creates a config path:
config_path = resource_filename(module_name, config_path)
directing to:
"lib/python3.8/site-packages/mmdet/configs/cascade_rcnn/cascade_mask_rcnn_r50_fpn_1x_coco.py"
but mmdet package doesn't include configs directory in the package so this is a bug that should be fixed.
solution:
add an argument local to download function and when local=False, download config files from mmdetection repo instead of searching in local mmdet package directory.
In fact, the config directory is copied from codebase directory to package directory by mim, so if we install codebase by pip, the config will be not found. Please refer to https://github.com/open-mmlab/mim/blob/main/mim/commands/install.py#L400
@zhouzaida install_from_wheel does not handle config directory issue: https://github.com/open-mmlab/mim/blob/1bb17cd47d5573f963542395d0f18c82b6d67710/mim/commands/install.py#L543
and mim install mmdet calls install_from_wheel function: https://github.com/open-mmlab/mim/blob/1bb17cd47d5573f963542395d0f18c82b6d67710/mim/commands/install.py#L217
if we install an openmmlab codebase (exclude mmcv), it will firstly clone the codebase from GitHub and install it. install_from_wheel just handles other packages.
The install command of mim will be refactored in the future version