Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error installing Gensim: "Could not import setuptools which is required to install from a source distribution."

Tags:

python

pip

gensim

Im trying to install gensim using pip but i'm getting:

"Could not import setuptools which is required to install from a source distribution.
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 377, in setup_py
import setuptools  # noqa
  File "/Library/Python/2.7/site-packages/setuptools/__init__.py", line 11, in <module>
from setuptools.extern.six.moves import filterfalse, map
  File "/Library/Python/2.7/site-packages/setuptools/extern/__init__.py", line 1, in <module>
from pkg_resources.extern import VendorImporter
ImportError: No module named extern"

Other posts have suggested running

 pip install -U setuptools

which reports to have successfully installed the package.

Installing collected packages: setuptools
Successfully installed setuptools-21.0.0

However, running the gensim pip install command:

pip install gensim

just gives the first error again.

any ideas why this might be happening?

like image 693
dizzle Avatar asked May 07 '16 14:05

dizzle


People also ask

Is setuptools installed by default with python?

Even in a vanilla version of Python 3.7. 6 (installed via pyenv ), the packages installed by default are both pip and setuptools .

How do I install setuptools on Windows?

The recommended way to install setuptools on Windows is to download ez_setup.py and run it. The script will download the appropriate . egg file and install it for you. Once installation is complete, you will find an easy_install program in your Python Scripts subdirectory.

Does python include setuptools?

Setuptools is a package development process library designed to facilitate packaging Python projects by enhancing the Python standard library distutils (distribution utilities). It includes: Python package and module definitions.


2 Answers

I had a very similar issue when installing SciPy Stack.

Try to use: pip install --user setuptools

Instead of using: pip install -U setuptools

like image 77
Murilo Horacio Avatar answered Nov 15 '22 10:11

Murilo Horacio


I had a similar error with another library. It took me two steps, but it could be overkill.

# apt-get install python-setuptools
# pip install -U setuptools
like image 30
RunThor Avatar answered Nov 15 '22 10:11

RunThor