OMP: Error #15: Initializing Libiomp5.dylib, But Found Libiomp5.dylib Already Initialized
Solution 1:
In most cases, this solves the problem:
conda install nomkl
Solution 2:
I have tried the following solutions that I have come across. Unfortunately, many of them did not work out and the reasons behind them are also not very clear:
I was using conda installed Tensorflow 2.0 MKL with python3.6 in mac OS Mojave
To downgrade matplotlib. What does it have to do something with OpenMP? Reason not clear but it did not work out.
conda install matplotlib==2.2.3Allow duplication of OpenMP library because of multiple copies of it exist. This works out but in the warning log, it says this is a workaround and silently produce incorrect results. So, definitely, this is not the way to go, therefore still a proper solution/fix is required.
import os os.environ['KMP_DUPLICATE_LIB_OK']='True'To install nomkl. I guess this is to not use MKL based binaries for all the libraries (scipy, numpy, tensorflow etc) but then I do not get the point why to use Tensorflow-MKL? because the whole point is to use MKL binaries to take advantage of the Intel architecture to do fast processing (AVX2 instructions etc). Most of the people said this worked out for them, however, this did not work out for me:
conda install nomklUpdate MKL. It did not work out.
conda install -c intel mklUninstall OpenMP and install it again. It did not work out.
conda uninstall openmp conda install openmpFinally, what I did is to uninstall conda installed tensorflow (tf-mkl) and install it again via pip. This has worked out!!! I think this is a proper solution. So, it might mean Intel TF-MKL binaries are broken for macOS. I have an observation this is common for Intel and macOS since other libraries like OpenVINO, pyrealsense2 etc are also not working well in macOS.
conda uninstall tensorflow pip install tensorflow==2.0.0
Some useful links:
Solution 3:
I had a similar experience and solutions posted elsewhere were not fixing things for me. Eventually I got unblocked by downgrading my version of matplotlib, i.e. conda install matplotlib=2.2.3
Solution 4:
i keep running into this error and it seems to have to do with dependency based installation and conda missing symlinks after that.
Example:
I installed a package with pip in my conda environment which had a torch dependency, and it did install successfully - but when importing i got the error above. The lib/ looked the following way:
~/opt/anaconda3/lib ll|grep libomp
lrwxr-xr-x 1 user staff 12B Dec 31 12:17 libgomp.1.dylib -> libomp.dylib
lrwxr-xr-x 1 user staff 12B Dec 31 12:17 libgomp.dylib -> libomp.dylib
lrwxr-xr-x 1 user staff 12B Dec 31 12:17 libiomp5.dylib -> libomp.dylib
-rwxrwxr-x 1 iser staff 642K Dec 31 12:17 libomp.dylib
I then used conda install pytorch which did install additional packages. After that my lib/looked like this:
~/opt/anaconda3/lib ll|grep libomp
lrwxr-xr-x 1 user staff 12B Dec 31 12:17 libgomp.1.dylib -> libomp.dylib
lrwxr-xr-x 1 user staff 12B Dec 31 12:17 libgomp.dylib -> libomp.dylib
lrwxr-xr-x 1 user staff 12B Mar 10 14:59 libiomp5.dylib -> libomp.dylib
-rwxrwxr-x 2 user staff 646K Jan 15 22:21 libomp.dylib
Hence the libomp.dylib and libiomp5.dylib symlink got updated. Import worked then.
I also fixed this issue before by manually creating a symlink between those libraries... so check if this looks valid for you!
Post a Comment for "OMP: Error #15: Initializing Libiomp5.dylib, But Found Libiomp5.dylib Already Initialized"