Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

python

Operating System: Window10

I use spyder (python3.8) in anaconda and after run the code, I get the following error:

[SpyderKernelApp] WARNING | No such comm: df7601e106dd11eba18accf9e4a3c0ef

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/.

How do I fix this?

like image 243
Bbest Nichapa Avatar asked Oct 05 '20 13:10

Bbest Nichapa


People also ask

What do you mean of error?

Definition of error 1a : an act or condition of ignorant or imprudent deviation from a code of behavior. b : an act involving an unintentional deviation from truth or accuracy made an error in adding up the bill.

What is the synonym of error?

Some common synonyms of error are blunder, lapse, mistake, and slip. While all these words mean "a departure from what is true, right, or proper," error suggests the existence of a standard or guide and a straying from the right course through failure to make effective use of this.

What is an error example?

2. The definition of an error is a mistake or the state of being wrong. An example of an error is when you add 2+2 and get 5. An example of error is when a mistake leads you to come to the wrong collusion and you continue to believe this incorrect conclusion. noun.

How many types of error are there?

Generally errors are classified into three types: systematic errors, random errors and blunders. Gross errors are caused by mistake in using instruments or meters, calculating measurement and recording data results.


3 Answers

import os
os.environ['KMP_DUPLICATE_LIB_OK']='True'
like image 60
Iaoceot Avatar answered Nov 15 '22 07:11

Iaoceot


This error occurs when there are multiple "libiomp5.dll" files within a python interpreter. I fixed it by deleting all of the versions of the file that were not within the module I was using (PyTorch). I would like to point out that this could cause a lot of multiprocessing issues down the road if you don't know what you are doing but I am sure it is nothing that can't be solved by looking it up on StackOverflow.

For more details visit: https://www.programmersought.com/article/53286415201/

like image 45
William Ramsey Avatar answered Nov 15 '22 06:11

William Ramsey


I'm not sure if this has been solved and you've moved on, but I just encountered this as well and was able to fix it with reinstalling a package with pip.

My machine has an AMD Ryzen 5 3400G CPU, and I frequently do machine learning and deep learning for university research. I first had this problem yesterday when I created a Tensorflow anaconda environment when I already had a separate PyTorch environment. I was also incorporating a colleague's code into mine, so I believe what Aenaon commented is valid, that what is imported matters.

Anyway, my solution - after researching where mkl is used - was to repeatedly pip uninstall and pip install one mkl-dependent package at a time until the problem went away when running my program. Somehow it was resolved after doing this the first time for numpy. I think it's coincidence, but my desired program works for now without any problems.

like image 26
S. Chang Avatar answered Nov 15 '22 06:11

S. Chang