I am running a python script and I get this error:
Intel MKL FATAL ERROR: Cannot load libmkl_avx2.so or libmkl_def.so.
Both files are present
The following worked for me
conda install -f numpy
In case anyone has a similar issue and gets errors that libmkl_p4m.so or libmkl_p4.so cannot be found (this occurred for me when calling certain numpy functions), I tried reinstalling / updating different python modules and reverting / updating to various versions of Anaconda, and neither worked. However I found that completely uninstalling anaconda and re-installing it (to version 4.4.10) solved the issue.
I ran into this problem after installing anaconda3 (vesion 4.2.0). The fix for me was simple, and I was able to keep using mkl. Just update to the latest numpy version.
conda update numpy
It is also possible that you are running Python in a folder which does not exist.
Solution is simply go to another folder.
See this question: sh: 0: getcwd() failed: No such file or directory on cited drive
If you use conda, try with these two commands:
conda install nomkl numpy scipy scikit-learn numexpr
conda remove mkl mkl-service
It should fix your problem.
None of the above answers worked for me. In my case, @Nehal J Wani
's comment below the OP's question led to the solution: As stated in the linked Intel support document, a single dynamic library can be used to link to the MKL.
After editing my project's Makefile to replace the following libraries
-lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core
with
-lmkl_rt
and re-building, the error disappeared.