Search code examples
pythonpacman-package-manager

ImportError: No module named sklearn.feature_extraction.text


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?


Solution

  • 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