Intel MKL FATAL ERROR: Cannot load or

I am running a python script and I get this error:

Intel MKL FATAL ERROR: Cannot load or

Both files are present in the anaconda2/lib directory. How can I fix this error? Thanks.


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.

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

Just wanted to note that Anaconda 4.0.0, shipped with mkl enabled by default, has this issue. The problem is indeed with Anaconda, as it can be reproduced with the simple python test below.

The actual issue is that Anaconda linked with mkl, but not with, thus it has a missing symbol, and can be seen by running:

$ LD_DEBUG=symbols python -c 'import sklearn.linear_model.tests.test_randomized_l1' 2>&1 | grep -i error
      2200:     /opt/anaconda/lib/python2.7/site-packages/scipy/special/../../../../ error: symbol lookup error: undefined symbol: mkl_dft_fft_fix_twiddle_table_32f (fatal)

I didn't want to uninstall mkl, as I'd like to have the performance boost, so I found a workaround which worked for me - preload before execution.

$ python -c 'import sklearn.linear_model.tests.test_randomized_l1'
Intel MKL FATAL ERROR: Cannot load or
$ LD_PRELOAD=/opt/anaconda/lib/ python -c 'import sklearn.linear_model.tests.test_randomized_l1'

Got the same problem and solved by using the command:

conda install nomkl

I got the solution from this discussion

I had this same issue using scikit-learn 0.19 and numpy 1.13.3 when running MLPRegressor (and also with a package called pyearth running an algorithm called MARS). I believe the root of the problem was that our python is part of an Anaconda install, but scikit-learn and numpy were installed via pip, and their expectations for mkl must not agree.

Unfortunately my framework is managed by some dedicated company admins, not by me, so I haven't gotten my guy to try recompiling numpy yet. But I was able to find a workaround based on this thread: Adding export LD_PRELOAD=/path/to/anaconda/lib/ to my ~/.bashrc causes the problem to disappear. It's super hacky, and I'd be lying if I said I knew exactly what it's doing (but this is helpful), so I'm hoping a recompile of numpy is a cleaner fix. But at least it works.

Note it is better performance-wise to have the versions of these packages that use mkl. Installing the nomkl versions is a workaround but not a true solution.

Wanted to add on Valilutzik and Zaikun Xu's thread. I can't add comments since I don't have enough points yet. conda install nomkl numpy scipy scikit-learn numexpr worked for me without having to remove mkl and mkl-service.

Adding an answer to Lee's question if nomkl will be slower: mkl is a Intel math kernel library and is hand-optimized for intel cpus. nomkl uses OpenBlas according to this: It seems that mkl is quite faster on many matrix operations for intel cpus (see I've seen someone saying nomkl is faster for AMD cpus (maybe because mkl doesn't work correctly in AMD?)

All the solutions provided above did not work for me, but I found a good compromise:

for someone who has the same error and want's to keep Anaconda on his computer, and steel use mkl for (numpy and scipy) good process performance, the solution I propose:

Edit your .bashrc file.

Look for something like export PATH="/home/anaconda2/bin:$PATH" in the file.

Put a # at the beginning to comment it from the script: #export PATH="/home/anaconda2/bin:$PATH"

Open a new terminal and you should be running the base python installation.

It worked for me, hope it will be helpfull.

In case anyone has a similar issue and gets errors that or 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.

Need Your Help

3 Dimensional Array Names in R

arrays r names

In the 3 Dimensional array bellow :

VBA Excel sort range by specific column

excel vba excel-vba sorting

I have a table that can contain any number of rows: