Pip install error. Setuptools.command not found
Asked Answered
I

4

22

I'm using a clean instance of Ubuntu server and would like to install some python packages in my virtualenv.

I receive the following output from the command 'pip install -r requirements.txt'

Downloading/unpacking pymongo==2.5.2 (from -r requirements.txt (line 7))
  Downloading pymongo-2.5.2.tar.gz (303kB): 303kB downloaded
  Running setup.py egg_info for package pymongo
    Traceback (most recent call last):
      File "<string>", line 3, in <module>
    ImportError: No module named setuptools.command
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 3, in <module>

ImportError: No module named setuptools.command

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /home/redacted/env/build/pymongo
Storing complete log in /home/redacted/.pip/pip.log

Any Idea what's going on?

python version 2.7.3

pip version pip 1.4 from /home/redacted/env/lib/python2.7/site-packages (python 2.7)

Inconspicuous answered 26/7, 2013 at 22:33 Comment(0)
R
29

Try installing:

sudo apt-get install python-setuptools

if this doesn't work try:

curl -O https://bootstrap.pypa.io/get-pip.py
python get-pip.py

Edit: If you have several (possible conflicting) python installations or environments, the following commands can be useful to debug which executables are being used:

which python
which pip
which easy_install

They should "match". It can happen for example that you have pip installing packages for an EPD or global distribution while the current python that is being used corresponds to a local environment (or something different), in which case it might not be able to see the installed packages.

Reshape answered 26/7, 2013 at 22:37 Comment(7)
I tried that, both globally as you suggested and with 'pip install setuptools' in my virutalenv. Still no luck.Inconspicuous
@Sam, what about now?Reshape
Still does not work, though now I have pip installed globally.Inconspicuous
@Sam, did you run easy_install and python inside the environment?Reshape
Can you explain to me why that worked when used inside the virtual environment?Inconspicuous
If you run which python and which easy_install you should see that the corresponding env's executable are being used.Reshape
DON'T USE THE LINK python-distribute will redirect you into spam websiteTasse
A
20

had the same problem, solved it with

pip install -U setuptools
Armillda answered 28/4, 2016 at 18:13 Comment(1)
This actually solved the problem when nothing else did. Seems to need a more updated setuptools than the ones that ship with either the OS or even a pyenv install. Weird.Arrive
I
3

Elaborating @elyase's Answer. First check for which python version you want to install setuptools. Normally both python versions comes default with debian or any linux distro. So, as per your requirement install setup tools using apt package manager

For python 2.x

sudo apt-get install python-setuptools

For python 3.x

sudo apt-get install python3-setuptools
Insure answered 4/6, 2019 at 19:9 Comment(1)
it doesn't work for me. I can run these commands but then if I try to invoke python-setuptools I get "python-setuptools: command not found"Phene
T
1

These instructions solved the problem for me:

first enter these commands

    pip install --upgrade pip
    pip install --upgrade wheel
    pip install setuptools

and then try to install the package that requires setuptools.

Theatrician answered 10/6, 2020 at 14:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.