0

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'
Tony Stark
  • 135
  • 3
  • 13

3 Answers3

2

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

Community
  • 1
  • 1
mtk
  • 13,221
  • 16
  • 72
  • 112
  • thank you, but this is a old question. i used spyder later then, now i can import with manually from [this site](http://www.lfd.uci.edu/~gohlke/pythonlibs). it is not a problem for me now. – Tony Stark Sep 30 '16 at 22:18
1

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.

Jibin Mathew
  • 4,816
  • 4
  • 40
  • 68
0

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.

Martin Evans
  • 45,791
  • 17
  • 81
  • 97
Francisco Gonzalez
  • 437
  • 1
  • 3
  • 15