ImportError: DLL load failed using sklearn

1

I have a Laptop with Win10 and I am working in Python3.6, and as a development environment I use PyCharm.

I have installed the following packages through Pip:

cycler (0.10.0)
matplotlib (2.0.2)
nose (1.3.7)
numpy (1.13.1)
pandas (0.20.3)
pip (9.0.1)
PyMySQL (0.7.11)
pyparsing (2.2.0)
python-dateutil (2.6.1)
pytz (2017.2)
scikit-learn (0.19.0)
scipy (0.19.1)
setuptools (28.8.0)
simpy (3.0.10)
six (1.10.0)
virtualenv (15.1.0)
wheel (0.30.0)

but when executing some code with the sklearn library, it shows me an error like the following:

    C:\Users\jvilchez\Downloads>python -c "import sklearn; sklearn.test()"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\jvilchez\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sklearn\__init__.py", line 134, in <module>
    from .base import clone
  File "C:\Users\jvilchez\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sklearn\base.py", line 12, in <module>
    from .utils.fixes import signature
  File "C:\Users\jvilchez\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sklearn\utils\__init__.py", line 11, in <module>
    from .validation import (as_float_array,
  File "C:\Users\jvilchez\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sklearn\utils\validation.py", line 18, in <module>
    from ..utils.fixes import signature
  File "C:\Users\jvilchez\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sklearn\utils\fixes.py", line 144, in <module>
    from scipy.sparse.linalg import lsqr as sparse_lsqr  # noqa
  File "C:\Users\jvilchez\AppData\Local\Programs\Python\Python36-32\lib\site-packages\scipy\sparse\linalg\__init__.py", line 113, in <module>
    from .isolve import *
  File "C:\Users\jvilchez\AppData\Local\Programs\Python\Python36-32\lib\site-packages\scipy\sparse\linalg\isolve\__init__.py", line 6, in <module>
    from .iterative import *
  File "C:\Users\jvilchez\AppData\Local\Programs\Python\Python36-32\lib\site-packages\scipy\sparse\linalg\isolve\iterative.py", line 7, in <module>
    from . import _iterative
ImportError: DLL load failed: No se puede encontrar el módulo especificado.

I've reinstalled it, I've searched the internet for information on how to fix it but nothing; what I'm trying to do is use this library for ML problems.

    
asked by Juan Alberto Vílchez 25.09.2017 в 19:30
source

1 answer

0

You can not be 100% sure but that error is typical when you do not have the version of NumPy with MKL (Intel® M ath K ernel L ibrary) included.

Viewing your version of NumPy we see that it does not include MKL, you have:

  

numpy (1.13.1)

And I should show something like:

  

numpy (1.13.1 + mkl)

To save you compilation problems you can download the corresponding binary from the Christoph Gohlke page of the University of California that collects a large number of precompiled binaries from the vast majority of Python scientific libraries:

link

The steps to follow would be:

  • If you have a 64-bit system with 64-bit Python installed, you should download numpy‑1.13.1+mkl‑cp36‑cp36m‑win_amd64.whl . Otherwise choose the appropriate file for your system.

  • Once downloaded, you go to the download folder with the File Explorer and in the address bar enter cmd . This opens the terminal in that working directory. You can also simply use cd or pass the full path of the file to pip later.

  • We are going to reinstall NumPy using the downloaded .whl. Enter the terminal:

     py -3.6 -m pip install numpy‑1.13.1+mkl‑cp36‑cp36m‑win_amd64.whl --upgrade --force-reinstall
    

    Replace numpy‑1.13.1+mkl‑cp36‑cp36m‑win_amd64.whl with the name of your downloaded file if necessary.

  • If it installs without errors, try again your script to see if the problem has been solved.

        
    answered by 25.09.2017 / 20:21
    source