1
votes

Python version : 3.5.2
I getting started with machine learning and things... So I installed sklearn and some other packages form pip. All of them were able to be 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 the order to check correct installation, I got tons of error :

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?

3
I suggest to uninstall sklearn and other dependencies and reinstalling them. It will be better if you can use Conda environment if its available. - Sreeram TP
Are you sure that the pip version you have used is the same as the Python environment you are working with? - Acsor
I didn't understand? Please explain. @none - user8369885
@SreeramTP Tried, Not worked! - user8369885
In my console, if I type pip<tab> Bash autocompletes with the following: None@vacuum:~$ pip pip pip3 pip3.5 pip3.6. That means I have several versions of pip installed. pip3.5 will work with Python 3.5.x only and pip3.6 only with Python 3.6.x. You need to use the appropriate pip version. - Acsor

3 Answers

4
votes

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.
1
votes

Various things need to be checked:

  1. Check numpy, scipy installation versions.
  2. If they are correct then try to import numpy and scipy.
  3. If they getting imported correctly, then clear your temp(c:/users/username/Appdata/local/temp)folder. Restart the machine and try again.
  4. Still if doesn't work, then uninstall scipy, numpy , sklearn and reinstall the proper wheel files
0
votes

Download and install numpy+mkl file.

Currently you might have installed only the numpy file.

  1. Go to: https://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy

  2. Download the corresponding wheel file in which is suitable for your python installation

  3. pip install "/path_to_thefile/numpy-1.14.6+mkl-cp36-cp36m-win_amd64.whl"

This should help you