1

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.

8
  • 3
    Please see: stackoverflow.com/questions/15274696/…
    – WilHall
    Oct 18, 2015 at 0:48
  • Thanks for the reply.I have already gone through that post and worked on the solutions mentioned, but still i keep getting the same error. Oct 18, 2015 at 0:49
  • 1
    Can you please verify that import scipy works from your script?
    – WilHall
    Oct 18, 2015 at 0:52
  • I havent used scipy in my scripts just sklearn Oct 18, 2015 at 0:55
  • 1
    Right, but verifying that import scipy works will verify that you have it installed, and that the Python interpreter you are running the script in is able to find the library.
    – WilHall
    Oct 18, 2015 at 0:57

2 Answers 2

4

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

2

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

0

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.