Error importing scikit-learn modules

后端 未结 9 822
盖世英雄少女心
盖世英雄少女心 2020-11-28 13:07

I\'m trying to call a function from the cluster module, like so:

import sklearn
db = sklearn.cluster.DBSCAN()

and I get the following error

相关标签:
9条回答
  • 2020-11-28 13:55

    Problem was with scipy/numpy install. I'd been using the (normally excellent!) unofficial installers from http://www.lfd.uci.edu/~gohlke/pythonlibs/. Uninstall/re-install from there made no difference, but installing with the official installers (linked from http://www.scipy.org/install.html) did the trick.

    0 讨论(0)
  • 2020-11-28 13:55

    I am using anaconda got the same error as the OP, when loading Orange, or PlotNine. I can't recall when this start to happen.

    Tracing the dependency of Anaconda3\Lib\site-packages\scipy\special\_ufuncs.cp36-win32.pyd, libifcoremd.dll and libmmd.dll are missing in DependencyWalk. Searching them in anaconda root directry, they are located in both ICC_RT and one version of MKL package.

    Adding Anaconda3\pkgs\mkl-2017.0.3-0\Library\bin to PATH, seems to fix SciPy and NumPy related DLL load failure, the above package starts to work again.

    I still don't know how to fix this properly. Apparently the downside is that the MKL package could be updated and versions may change so does the path. In this aspect Its equally inconvenient as adding a non-managed package.

    Reinstalling ICC_RT fixed the issue for me, libmmd.dll and the related dlls are automatically copied into anaconda3/library/bin afterwards, which is automatically added into PATH by activate command. All previous numpy/scipy related cant load DLL errors are gone now.

    0 讨论(0)
  • 2020-11-28 13:57

    Place this line on top of the python file

    from sklearn import cluster
    

    That should do it :))

    0 讨论(0)
提交回复
热议问题