Frequently Asked Questions¶
We list some common troubles faced by many users and their corresponding solutions here. Feel free to enrich the list if you find any frequent issues and have ways to help others to solve them.
Installation¶
KeyError: “xxx: ‘yyy is not in the zzz registry’”
The registry mechanism will be triggered only when the file of the module is imported. So you need to import that file somewhere. More details can be found at KeyError: “MaskRCNN: ‘RefineRoIHead is not in the models registry’”.
“No module named ‘mmcv.ops’”; “No module named ‘mmcv._ext’”
Check your os, python, torch (+cuda) versions, e.g. python 3.10 and torch 2.8.0+cu128.
If you upgraded/changed your pytorch version since you installed onedl-mmcv, you need to install oneld-mmcv again.
Check if your combination has a prebuilt wheel.
Go to our package index and check if your cuda + torch version is in the list.
Click your version and go to the onedl-mmcv index.
Check if your python version is supported (and if your OS is supported too).
If there is a prebuilt wheel
Uninstall the existing onedl-mmcv
pip uninstall onedl-mmcvInstall while forcing binary:
mim install onedl-mmcv --only-binary=onedl-mmcv.If this fails, check the logs of running the command with the
-vflag. Is the index looking in the right place? (if not, check again your pytorch+cuda version). It could be your manylinux is not the same (usepip debug --python-version 3.10 --verbose | grep manylinuxto check).
If there is not a prebuilt wheel, you need to build from source:
Uninstall existing mmcv in the environment using
pip uninstall mmcvInstall onedl-mmcv following the installation instruction or Build MMCV from source
“invalid device function” or “no kernel image is available for execution”
Check the CUDA compute capability of you GPU
Run
python mmdet/utils/collect_env.pyto check whether PyTorch, torchvision, and MMCV are built for the correct GPU architecture. You may need to setTORCH_CUDA_ARCH_LISTto reinstall MMCV. The compatibility issue could happen when using old GPUS, e.g., Tesla K80 (3.7) on colab.Check whether the running environment is the same as that when mmcv/mmdet is compiled. For example, you may compile mmcv using CUDA 10.0 bug run it on CUDA9.0 environments
“undefined symbol” or “cannot open xxx.so”
If those symbols are CUDA/C++ symbols (e.g., libcudart.so or GLIBCXX), check whether the CUDA/GCC runtimes are the same as those used for compiling mmcv
If those symbols are Pytorch symbols (e.g., symbols containing caffe, aten, and TH), check whether the Pytorch version is the same as that used for compiling mmcv
Run
python mmdet/utils/collect_env.pyto check whether PyTorch, torchvision, and MMCV are built by and running on the same environment
“RuntimeError: CUDA error: invalid configuration argument”
This error may be caused by the poor performance of GPU. Try to decrease the value of THREADS_PER_BLOCK and recompile mmcv.
“RuntimeError: nms is not compiled with GPU support”
This error is because your CUDA environment is not installed correctly. You may try to re-install your CUDA environment and then delete the build/ folder before re-compile mmcv.
“Segmentation fault”
Check your GCC version and use GCC >= 5.4. This usually caused by the incompatibility between PyTorch and the environment (e.g., GCC < 4.9 for PyTorch). We also recommend the users to avoid using GCC 5.5 because many feedbacks report that GCC 5.5 will cause “segmentation fault” and simply changing it to GCC 5.4 could solve the problem
Check whether PyTorch is correctly installed and could use CUDA op, e.g. type the following command in your terminal and see whether they could correctly output results
python -c 'import torch; print(torch.cuda.is_available())'
If PyTorch is correctly installed, check whether MMCV is correctly installed. If MMCV is correctly installed, then there will be no issue of the command
python -c 'import mmcv; import mmcv.ops'
If MMCV and PyTorch are correctly installed, you can use
ipdbto set breakpoints or directly addprintto debug and see which part leads thesegmentation fault
“libtorch_cuda_cu.so: cannot open shared object file”
onedl-mmcvdepends on the share object but it can not be found. We can check whether the object exists in~/miniconda3/envs/{environment-name}/lib/python3.7/site-packages/torch/libor try to re-install the PyTorch.Compatibility issue between MMCV and MMDetection; “ConvWS is already registered in conv layer”
Please install the correct version of MMCV for the version of your MMDetection following the installation instruction.
Usage¶
“RuntimeError: Expected to have finished reduction in the prior iteration before starting a new one”
This error indicates that your module has parameters that were not used in producing loss. This phenomenon may be caused by running different branches in your code in DDP mode. More datails at Expected to have finished reduction in the prior iteration before starting a new one.
You can set
find_unused_parameters = Truein the config to solve the above problems or find those unused parameters manually
“RuntimeError: Trying to backward through the graph a second time”
GradientCumulativeOptimizerHookandOptimizerHookare both set which causes theloss.backward()to be called twice soRuntimeErrorwas raised. We can only use one of these. More datails at Trying to backward through the graph a second time.