Error importing scikit-learn modules

后端 未结 9 838
盖世英雄少女心
盖世英雄少女心 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:45

    From the error log, it shows that scipy module is the most recent module fails to import

      File "C:\Python34\lib\site-packages\sklearn\utils\fixes.py", line 318, in <module>
        from scipy.sparse.linalg import lsqr as sparse_lsqr
      File "C:\Python34\lib\site-packages\scipy\sparse\linalg\__init__.py", line 109, in <module>
        from .isolve import *
      File "C:\Python34\lib\site-packages\scipy\sparse\linalg\isolve\__init__.py", line 6, in <module>
        from .iterative import *
      File "C:\Python34\lib\site-packages\scipy\sparse\linalg\isolve\iterative.py", line 7, in <module>
        from . import _iterative
    ImportError: DLL load failed: The specified module could not be found.
    

    I have the same error that show the same log, the problem'd gone when I uninstall/install scipy:

    pip uninstall scipy
    pip install scipy
    
    0 讨论(0)
  • 2020-11-28 13:45

    download microsoft visual c++ distribution

    link : https://www.microsoft.com/en-in/download/details.aspx?id=53840

    vc_redist.x64.exe

    install and run this .exe file in your computer.. the DLL import module error will not appear after this

    now it will work fine enjoy :)

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

    I struggled trying to figure this one out; tried to download and install the (unofficial) Numpy+MKL library from the website (risky/tedious?).

    Ultimately found success by:

    1. Login to command prompt using admin rights; how to here: https://superuser.com/questions/968214/open-cmd-as-admin-with-windowsr-shortcut

    2. Uninstall existing/tangled version of Scipy & Numpy pip uninstall scipy pip uninstall numpy

    3. Fresh install Scipy & Numpy pip install scipy pip install numpy

    4. Run Jupyter notebook; it worked for me.

    The message ImportError: DLL load failed: The specified module could not be found informs that there is failure to identify and source the required DLL(s) to use the scikit-learn library; a fresh install of scipy/numpy probably enables a better routing of DLL connections called from Jupyter notebook code(s).

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

    For me what fixed it were these commands:

    pip uninstall sklearn
    pip uninstall scikit-learn
    pip uninstall scipy
    pip install scipy
    pip install scikit-learnhere
    
    0 讨论(0)
  • 2020-11-28 13:52

    I had the same issue and solved it by installing/updating the mkl package:

    conda install mkl
    

    or

    pip install mkl
    

    Just for full information, this also downgraded the following packages:

    The following packages will be UPDATED:

    mkl:          2017.0.4-h6d528fc_0 defaults --> 2018.0.3-1         defaults
    

    The following packages will be DOWNGRADED:

    numpy:        1.11.3-py34_0       defaults --> 1.10.1-py34_0      defaults
    pandas:       0.19.2-np111py34_1  defaults --> 0.18.1-np110py34_0 defaults
    scikit-learn: 0.18.1-np111py34_1  defaults --> 0.17-np110py34_1   defaults
    scipy:        0.19.1-np111py34_0  defaults --> 0.16.0-np110py34_0 defaults
    
    0 讨论(0)
  • 2020-11-28 13:53

    You probably don't use Numpy+MKL, but only Numpy.

    I had the same problem and reinstalling Numpy with MKL

    pip install --upgrade --force-reinstall "numpy‑1.16.3+mkl‑cp37‑cp37m‑win32.whl"

    fixed it.

    Note: update the file to the latest version, possibly 64bit - see the list of available Windows binaries

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