Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pip install error. Setuptools.command not found

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)

like image 212
Sam Avatar asked Jul 26 '13 22:07

Sam


People also ask

How do I import setuptools in Python?

Follow the below steps to install the Setuptools package on Linux using the setup.py file: Step 1: Download the latest source package of Setuptools for Python3 from the website. Step 3: Go to the setuptools-60.5. 0 folder and enter the following command to install the package.


3 Answers

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.

like image 119
elyase Avatar answered Sep 29 '22 11:09

elyase


had the same problem, solved it with

pip install -U setuptools
like image 36
BrunoMartins Avatar answered Sep 29 '22 12:09

BrunoMartins


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
like image 30
Krunal Sonparate Avatar answered Sep 29 '22 13:09

Krunal Sonparate