mmdetection installation errors: possible fixes #12328
Unanswered
anushka-kore
asked this question in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I was facing a ton of issues getting the mmdetection toolbox working even after following the installation guide, especially conflicts with certain packages (setuptools) and predependencies (mmcv). Any beginner (like me) installing the toolbox might encounter these common errors-
AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. openxlab 0.1.2 requires setuptools~=60.2.0, but you have setuptools 76.0.0 which is incompatible.
This error originates from a subprocess, and is likely not a problem with pip
ModuleNotFoundError: No module named 'mmcv._ext'
Having gone through a lot of discussions and issues in the repo and some tweaking, I finally found a resolution to my issues. I'm noting the process I followed here, which would hopefully help anyone facing the same problems with installation.
The steps-
python 3.8
and navigate there, say,mkdir -p mmdet_project && cd mmdet_project
. If you don't have python 3.8, I would recommend installing it first and making sure it is loaded.CUDA
version. That can be done bynvcc --version
ornvidia-smi
if you have a NVIDA GPU. If CUDA is installed, you’ll see an output like:nvcc: NVIDIA (R) Cuda compiler release 12.4, V11.8.89
This means you have CUDA 12.4.
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124
.pip install -U openmim
mim install mmengine
mim install mmcv-full
Note that the last prompt installs mmcv-full-1.7.2 which is going to give us an assertion error later because of mmdetection's mmcv version requirement.
git clone https://github.com/open-mmlab/mmdetection.git
cd mmdetection
pip install -v -e .
Note that this installation is still under your
mmdet_project
directory that you had initially created.mim download mmdet --config rtmdet_tiny_8xb32-300e_coco --dest .
python demo/image_demo.py demo/demo.jpg rtmdet_tiny_8xb32-300e_coco.py --weights rtmdet_tiny_8xb32-300e_coco_20220902_112414-78e30dcc.pth --device cpu
But running this will give us the assertion error as previously anticipated. You might see something like-
AssertionError: MMCV==1.7.2 is used but incompatible. Please install mmcv>=2.0.0rc4, <2.2.0
. Now the installation guide tells you to domim install "mmcv==<version>"
but do NOT do this. Instead, install using pip-pip install "mmcv>=2.0.0rc4,<2.2.0"
to overcome the assertion error and issues with mim installation. This will install mmcv-2.1.0.Now the mmdetection toolbox is ready to be used. Hope this helps someone.
Beta Was this translation helpful? Give feedback.
All reactions