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
EDITThe 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:
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
Slicing of a Numpy 2D Array, or How to Extract an Mxm Submatrix from an Nxn Array (N>M)
Python: Can't Pickle Type X, Attribute Lookup Failed
How to Use the Optional Type Hint
Python Argparse: Default Value or Specified Value
"Pip Install --Editable ./" VS "Python Setup.Py Develop"
Plotting Results of Hierarchical Clustering Ontop of a Matrix of Data in Python
Change to Sudo User Within a Python Script
Is There a Numpy Builtin to Reject Outliers from a List
How to Get the Version Defined in Setup.Py (Setuptools) in My Package
Convert Date to Datetime in Python
Why Results of Map() and List Comprehension Are Different
How to Get a List of Keywords in Python
Spark Dataframe: Computing Row-Wise Mean (Or Any Aggregate Operation)
Asyncio: How to Cancel a Future Been Run by an Executor
Find All Upper, Lower and Mixed Case Combinations of a String