ImportError: No module named sklearn.feature_extraction.text

2 8 picture 2 8 · Jul 21, 2014 · Viewed 27.3k times · Source

I use from python 2.7 and pacman package manager, and install sclearn with it. but when i have an ImportError:

>>> from sklearn.feature_extraction.text import TfidfVectorizer
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named sklearn.feature_extraction.text

How i can fix this error?

Answer

Nadine picture Nadine · Aug 24, 2014

For python 2, you should be able to use this command to install using pacman:

pacman -S python2-scikit-learn

Make sure the package name has the number "2" in it.

As per scikit-learn's installation guide, another way to install it is using pip:

pip install --user --install-option="--prefix=" -U scikit-learn