ImportError: cannot import name NUMPY_MKL

Steve picture Steve · May 17, 2016 · Viewed 104.2k times · Source

I am trying to run the following simple code

import scipy
scipy.test()

But I am getting the following error

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 586, in runfile
    execfile(filename, namespace)
  File "C:/Users/Mustafa/Documents/My Python Code/SpectralGraphAnalysis/main.py", line 8, in <module>
    import scipy
  File "C:\Python27\lib\site-packages\scipy\__init__.py", line 61, in <module>
    from numpy._distributor_init import NUMPY_MKL  # requires numpy+mkl
ImportError: cannot import name NUMPY_MKL

I am using python 2.7 under windows 10.

I have installed scipy but that does not seem to solve the problem

Any help is appreciated.

Answer

VMAtm picture VMAtm · May 17, 2016

If you look at the line which is causing the error, you'll see this:

from numpy._distributor_init import NUMPY_MKL  # requires numpy+mkl

This line comment states the dependency as numpy+mkl (numpy with Intel Math Kernel Library). This means that you've installed the numpy by pip, but the scipy was installed by precompiled archive, which expects numpy+mkl.

This problem can be easy solved by installation for numpy+mkl from whl file from here.