Running in ImportError with sklearn when running a tutorial

Hi, I am trying to follow the 101 training course provided by sklearn and I am always confronted with an error.

I have the latest version of sklearn downloaded here: https://github.com/scikit-learn/scikit-learn

I am running windows

python: 2.7.5 (32 bit)

scipy: .12

numpy: 1.7.0

When i started

from sklearn.linear_model import LinearRegression model = LinearRegression() 

I get

 --------------------------------------------------------------------------- ImportError Traceback (most recent call last) <ipython-input-7-9f5ae92552bb> in <module>() ----> 1 from sklearn.linear_model import LinearRegression 2 model = LinearRegression() C:\WinPython-32bit-2.7.5.1\python-2.7.5\lib\site-packages\sklearn\linear_model\__init__.py in <module>() 10 # complete documentation. 11 ---> 12 from .base import LinearRegression 13 14 from .bayes import BayesianRidge, ARDRegression C:\WinPython-32bit-2.7.5.1\python-2.7.5\lib\site-packages\sklearn\linear_model\base.py in <module>() 28 from ..utils.sparsefuncs import (csc_mean_variance_axis0, 29 inplace_csc_column_scale) ---> 30 from .cd_fast import sparse_std 31 32 ImportError: No module named cd_fast 

And based on this: https://github.com/scikit-learn/scikit-learn/issues/1202

Could this be a blas error? But this is in scipy, and I had problems with this before, but I just updated scipy, and everything should be fine.

Please, help! thanks in advance

+1
source share
2 answers

You forgot to compile. Run python setup.py install in the source directory or python setup.py build_ext --inplace or take a binary distribution.

(Most of scikit-learn is actually implemented in Cython, C, or C ++. You need C and C ++ compilers to install from the source.)

+3
source

Copy the answer from another question: If you are using binaries from http://www.lfd.uci.edu/~gohlke/pythonlibs/#scikit-learn . They require numpy-MKL, as indicated on the download page. The official numpy binaries will not work.

0
source

Source: https://habr.com/ru/post/1242161/


All Articles