Tag Archives: mmdetection

[Solved] OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.

Error 1. OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.
Error Message:

OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.
OMP: Hint This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous, since it can degrade performance or cause incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, e.g. by avoiding static linking of the OpenMP runtime in any library. As an unsafe, unsupported, undocumented workaround you can set the environment variable KMP_DUPLICATE_LIB_OK=TRUE to allow the program to continue to execute, but that may cause crashes or silently produce incorrect results. For more information, please see http://www.intel.com/software/products/support/.

Solution 1:

When debugging a program in pycharm, you can directly add these two statements in front of the program

import os
os.environ[“KMP_DUPLICATE_LIB_OK”]=“TRUE”

Solution 2:

If Method 1 fails to solve the problem, even importing torch directly on the terminal will cause this problem:

The reason for this is actually that there are two libiomp5md.dll files in the environment of anaconda. So go directly to the path of the virtual environment and search for this file, you can see that there are two dll files in the environment.

The first one is in the path of torch, and the second one is in the path of virtual environment itself. Go to the second directory and cut it to other paths for backup (it is better to back up the path as well).

Error 2.ModuleNotFoundError: No module named ‘mmcv._ext ‘

When using the target detection open source tool MMDetection, the following error occurs:

ModuleNotFoundError: No module named 'mmcv._ext'

It is likely that you did not specify a version when you started the installation of mmcv-full and chose to install it directly, as follows:

pip install mmcv-full

By default, mmcv full is installed. If it does not match the cuda and torch versions in your environment, the above error is likely to occur

Uninstall the original mmcv

pip uninstall mmcv-full

Reinstall the correct version of mmcv full

where {cu_version}, {torch_version} correspond to the version numbers of cuda and torch respectively

pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/{cu_version}/{torch_version}/index.html

For example, I installed cuda10.2 and pytorch 1.8.0, so I should enter the command:

pip install mmcv-full==1.2.4 -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.8.0/index.html

Note: mmcv-full I recommend version 1.2.4.