Search code examples
pythonpython-3.xscikit-learnpippython-wheel

'ImportError: DLL load failed: The specified module could not be found' when importing sklearn


Python version: 3.5.2
I installed sklearn and some other packages form pip. All of them were installed successfully except sklearn so, I downloaded the wheel and installed it from here. It was successfully installed but when i tried to import it in order to check correct installation, I got tons of errors:

Traceback (most recent call last): File "C:\MyFiles\Programs\Python\PlayGround.py", line 1, in import sklearn
File "C:\Users\Vaibhav Acharya\AppData\Local\Programs\Python\Python35\lib\site-packages\sklearn_init_.py", line 134, in from .base import clone
File "C:\Users\Vaibhav Acharya\AppData\Local\Programs\Python\Python35\lib\site-packages\sklearn\base.py", line 12, in from .utils.fixes import signature
File "C:\Users\Vaibhav Acharya\AppData\Local\Programs\Python\Python35\lib\site-packages\sklearn\utils_init_.py", line 11, in from .validation import (as_float_array,
File "C:\Users\Vaibhav Acharya\AppData\Local\Programs\Python\Python35\lib\site-packages\sklearn\utils\validation.py", line 18, in from ..utils.fixes import signature
File "C:\Users\Vaibhav Acharya\AppData\Local\Programs\Python\Python35\lib\site-packages\sklearn\utils\fixes.py", line 144, in from scipy.sparse.linalg import lsqr as sparse_lsqr # noqa
File "C:\Users\Vaibhav Acharya\AppData\Local\Programs\Python\Python35\lib\site-packages\scipy\sparse\linalg_init_.py", line 114, in from .isolve import *
File "C:\Users\Vaibhav Acharya\AppData\Local\Programs\Python\Python35\lib\site-packages\scipy\sparse\linalg\isolve_init_.py", line 6, in from .iterative import *
File "C:\Users\Vaibhav Acharya\AppData\Local\Programs\Python\Python35\lib\site-packages\scipy\sparse\linalg\isolve\iterative.py", line 7, in from . import _iterative

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

And the code was just:

import sklearn

I have already checked correct version of wheel package which I have downloaded.
How can I correct it and why it is occurring?


Solution

  • The following steps solved my problem :

    1. Uninstalling numpy, sklearn and scipy.
    2. Downloading numpy+mkl and scipy from here.
    3. Firstly installing numpy+mkl and then scipy.
    4. Installing sklearn from pip.