简体   繁体   中英

Scikitlearn in Jupyter notebook using Anaconda

This is not a duplicate because the linked question does not address how to either locate the required dlls or fix the installation.

I get the following when I try import sklearn v.0.20. I'm using anaconda and both numpy and scipy are up to date.

ImportError                               Traceback (most recent call last)
<ipython-input-1-8fd979e02004> in <module>()
----> 1 import sklearn

C:\Users\James2SxyBoogaloo\Anaconda3\lib\site-packages\sklearn\__init__.py in <module>()
     62 else:
     63     from . import __check_build
---> 64     from .base import clone
     65     from .utils._show_versions import show_versions
     66 

C:\Users\James2SxyBoogaloo\Anaconda3\lib\site-packages\sklearn\base.py in <module>()
     11 from scipy import sparse
     12 from .externals import six
---> 13 from .utils.fixes import signature
     14 from . import __version__
     15 

C:\Users\James2SxyBoogaloo\Anaconda3\lib\site-packages\sklearn\utils\__init__.py in <module>()
     11 
     12 from .murmurhash import murmurhash3_32
---> 13 from .validation import (as_float_array,
     14                          assert_all_finite,
     15                          check_random_state, column_or_1d, check_array,

C:\Users\James2SxyBoogaloo\Anaconda3\lib\site-packages\sklearn\utils\validation.py in <module>()
     20 
     21 from ..externals import six
---> 22 from ..utils.fixes import signature
     23 from .. import get_config as _get_config
     24 from ..exceptions import NonBLASDotWarning

C:\Users\James2SxyBoogaloo\Anaconda3\lib\site-packages\sklearn\utils\fixes.py in <module>()
     81             return stats.boxcox(x, lmbda)
     82 else:
---> 83     from scipy.special import boxcox  # noqa
     84 
     85 

    C:\Users\James2SxyBoogaloo\Anaconda3\lib\site-packages\scipy\special\__init__.py in <module>()
    638 from .sf_error import SpecialFunctionWarning, SpecialFunctionError
    639 
--> 640 from ._ufuncs import *
    641 
    642 from .basic import *

ImportError: DLL load failed: The specified module could not be found.

EDIT:

I found this thread : https://github.com/numpy/numpy/issues/10965

That mentions a problem related to this.

So it seems the guy there solved his problem by removing both numpy and scipy and reinstalling them. There is a chance your version of scipy for some reason is linked against a MLK version of numpy and that's the reason things don't work.

END OF EDIT


I checked around for your problem and it seems that this is related to the version of numpy you have.

To fix the problem you should install numpy-MLK which is a version on numpy linked against Intel's Math Kernel Library.

You can find it here: https://pypi.org/project/numpy-mkl/

Just remember to first remove the already existing numpy package.

You can find more info here:

ImportError when importing certain modules from SciPY

and here:

Difference between Numpy and Numpy-MKL?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM