user4813927
user4813927

Reputation:

Python can't find setuptools

I got the following ImportError as i tried to setup.py install a package:

Traceback (most recent call last):
   File "setup.py", line 4, in <module>
    from setuptools import setup, Extension
ImportError: No module named setuptools

This happens although setuptools is already installed:

amir@amir-debian:~$ sudo apt-get install python-setuptools
[sudo] password for amir: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python-setuptools is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Why can't python find the setuptools module?

Upvotes: 1

Views: 13777

Answers (1)

IzPrEE
IzPrEE

Reputation: 313

It's possible you have multiple python versions installed on your system. For example if you installed your python from source, and then again with apt-get. Apt-get will install to the default python version. Make sure you are being consistent.

Potentially using pip install setuptools could solve your problem.

Try these commands:

$which python
/usr/bin/python
$python --version
Python 2.7.12

Making sure that the output matches your expectations.

It may be worth removing previous installations and starting over as this answer suggests:

Python 3: ImportError "No Module named Setuptools"

Upvotes: 1

Related Questions