Error Importing Scikit-Learn Modules

Error importing scikit-learn modules

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.

Import Error on importing sklearn in Python

Do you use Windows? From the error that you posted I say yes.

Open your terminal (cmd) and try these before you try to import the sklearn.

pip install -U scikit-learn

or

conda install scikit-learn

Also make sure your have numpy and scipy:

pip install numpy 
pip install scipy

EDIT

The conda error means that the conda is not in you PATH environment.

To solve this, Uninstall Anaconda and install it again, this time by selecting BOTH the options in the installation instruction as shown:

Sample Image

EDIT 2

If you do not have pip then, download from here the get-pip.py file and then use cmd to run python get-pip.py inside the folder in which get-pip.py is saved

import scikit-learn module failing

Change in visual studio your python executable to take this of your conda environment. In linux this one is in conda_dir/envs/yourenv/bin, I think it can be the same in windows.

Cannot import Scikit-Learn

I'm not really sure, but according to this that error happens when a package that depends on numpy is compiled targeting a specific version (or a specific platform), and that package is then installed in a different environment. How did you install those two packages? (numpy and scipy)

I'd suggest uninstalling both and then reinstalling SciPy, either using pip or from source.

Unable to Import scikit-learn after installation

Figured it out! @yoyoyo helped me by suggesting the conda environment. Conda comes with scipy, scikit-learn, and scikit-image all preinstalled. No headache of installing and importing any of my needed modules with conda.



Related Topics



Leave a reply



Submit