Install Scipy with MKL through PIP

tndoan picture tndoan · Feb 24, 2014 · Viewed 41.7k times · Source

I am using PIP to install Scipy with MKL to accelerate the performance. My OS is Ubuntu 64 bit. Using the solution from this question, I create a file .numpy-site.cfg

[mkl]
library_dirs=/opt/intel/composer_xe_2013_sp1/mkl/lib/intel64/
include_dirs=/opt/intel/mkl/include/
mkl_libs=mkl_intel_lp64,mkl_intel_thread,mkl_core,mkl_rt
lapack_libs=

This file helps me to install Numpy with MKL successfully. However, using the same above file, installing Scipy prompts the error

ImportError: libmkl_rt.so: cannot open shared object file: No such file or directory

I also use

export LD_LIBRARY_PATH=/opt/intel/composer_xe_2013_sp1/mkl/lib/intel64

but the problem is still the same.

Anyone know how to fix this problem? I don't want to install Scipy manually so anyone give me some hints to fix it.

Answer

t7t0t0t7t picture t7t0t0t7t · Jun 19, 2018

Intel has been publishing wheels of packages like Numpy, Scipy and Scikit-learn to PyPI. These wheels have been built while linking against Intel MKL, and include various optimizations.

If you want Scipy built with Intel MKL:

#Remove existing Numpy and/or Scipy:
pip uninstall numpy scipy -y
#Install scipy built with Intel MKL:
pip install intel-scipy

More information available here