2
Python 3.5.2 |Anaconda custom (64-bit)| (default, Jul  2 2016, 17:53:06) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from cvxopt import matrix
>>> 2 * matrix(1.0, (1, 4))
Intel MKL FATAL ERROR: Cannot load libmkl_avx.so or libmkl_def.so

When running the above scripts I get an Intel MKL Fatal Error. The test that is mentioned in issues with similar error passed. The test is

python -c 'import sklearn.linear_model.tests.test_randomized_l1'

I ran python with LD_DEBUG=symbols and see the below error in the logs

/opt/anaconda3/lib/python3.5/site-packages/cvxopt/../../../libmkl_avx.so: error: symbol lookup error: undefined symbol: mkl_sparse_optimize_bsr_trsm_i8 (fatal)

Does anyone know how to fix this? I am interested in retaining the mkl option and not the nomkl one

NOTE mkl is installed and at newest version and so is scikit-learn

rrao
  • 297
  • 4
  • 11

2 Answers2

2

I ran into this while running the examples on http://scikit-learn.org/stable/modules/linear_model.html. Apparently a bunch of libraries are not being loaded automatically. Here are the manual loads I'm using so far, others will probably be needed depending on what you are doing. For me it did fix the one test case in the question.

CONDA_LIB=$CONDA_PREFIX/../../lib
LIBS=$CONDA_LIB/libmkl_intel_thread.so:$CONDA_LIB/libmkl_avx.so:$CONDA_LIB/libmkl_core.so:$CONDA_LIB/libiomp5.so:/lib/libgomp.so
LD_PRELOAD=$LIBS python
0

The mkl package is probably missing in your anaconda installation.

a) You could try to upgrade anaconda completely:

conda upgrade anaconda

b) Alternatively you could explicitly install mkl:

conda install mkl

I have not checked a), but used b). In this case you might need to upgrade also sklearn module:

conda upgrade scikit-learn
RA Prism
  • 59
  • 6