Tony Stark
Tony Stark

Reputation: 145

I cant import sklearn

I try to import scikit-learn, but there is an error. i installed sklearn, scipy on anaconda. i am using W10 and python 3.5.

>>> import sklearn
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import sklearn
  File "C:\Users\lenovo\AppData\Local\Programs\Python\Python35-32\lib\site-packages\sklearn\__init__.py", line 57, in <module>
    from .base import clone
  File "C:\Users\lenovo\AppData\Local\Programs\Python\Python35-32\lib\site-packages\sklearn\base.py", line 9, in <module>
    from scipy import sparse
ImportError: No module named 'scipy'

Upvotes: 0

Views: 2377

Answers (3)

Francisco Gonzalez
Francisco Gonzalez

Reputation: 455

Using pip, or interpreter setting in pycharm:

  1. pip install NumPy+mkl
    numpy-mkl 1.10.2
    Install module NumPy+mkl

  2. pip install SciPy
    Install module SciPy

Now you can install sklearn.

  1. pip install scikit-learn
    Install module scikit-learn

Hope that it is useful.

Upvotes: 0

Jibin Mathew
Jibin Mathew

Reputation: 5102

Use pip to install the packages

  1. pip install numpy
  2. pip install scipy
  3. pip install -U scikit-learn

Ensure you have appropriate privileges for installing globally or in virtual environment.

Upvotes: 1

mtk
mtk

Reputation: 13709

In linux there is pip install <module> to install a module, and if you are using anaconda then conda install <module>, I believe there would be something similar in windows.

If you are sure that you have installed scipy module, then probably the python path is not looking for those directories.

You can try a environment variable PYTHONPATH that has a list of directories to append before launching python prompt. OR you can test it for a session by adding it to sys.path

Upvotes: 2

Related Questions