user2471313
user2471313

Reputation: 63

ImportError: cannot import name __check_build while importing TfidfVectorizer from sklearn

I am using Python 2.7.10 and have installed scikit-0.15.2 using pip and i already have "numpy-1.1.10" and "scipy-0.16.0" installed and it works fine but when i try to import TfidfVectorizer from sklearn to construct a term document matrix with tf-idf values

from sklearn.feature_extraction.text import TfidfVectorizer

i get an error:

Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    import sklearn
  File "C:\Python27\lib\site-packages\sklearn\__init__.py", line 37, in <module>
    from . import __check_build
ImportError: cannot import name __check_build

I have already gone through the earlier post and tried the solutions but it didn't work.

Upvotes: 1

Views: 16333

Answers (2)

Lewis Parker
Lewis Parker

Reputation: 71

For windows user try to install numpy+mkl package from http://www.lfd.uci.edu/~gohlke/pythonlibs/#scikit-learn and after successful installation restart the python

Upvotes: 4

Thom
Thom

Reputation: 560

Had the same problem. installing scipy solved the problem for me. Try...

#sudo pip install scipy

What does it say if you fire up a python prompt and type

import scipy

also there might be some pointers in this thread ImportError in importing from sklearn: cannot import name check_build

Upvotes: 2

Related Questions