47

I downloaded the ez_setup code from here: http://peak.telecommunity.com/dist/ez_setup.py and ran it, but i don't think setuptools was properly installed. When i try to open an egg using easy_install i am getting a NameError. Any thoughts?

Here is the specific error:

Traceback (most recent call last):
  File "C:...setup.py", line 223, in <module>
    easy_install eggsetup.py
NameError: name 'easy_install' is not defined
Ondrej Slinták
  • 31,386
  • 20
  • 94
  • 126
dopatraman
  • 13,416
  • 29
  • 90
  • 154

9 Answers9

97

For linux versions(ubuntu/linux mint), you can always type this in the command prompt:

sudo apt-get install python-setuptools

This will automatically install easy_install.

pevik
  • 4,523
  • 3
  • 33
  • 44
Anusha Rao
  • 995
  • 6
  • 3
  • 6
    I wish it was but this version is so old things will not install properly (like Buildout). – Wernight Dec 21 '13 at 02:22
  • After doing this, another install which depends on setuptools *still* tells me that setuptools isn't installed! – Michael Jun 26 '19 at 00:16
37

For python3 on Ubuntu

 sudo apt-get install python3-setuptools
Ahmad Yoosofan
  • 961
  • 12
  • 21
12

please try to install the dependencie with pip, run this command:

sudo pip install -U setuptools
Wellington1993
  • 340
  • 1
  • 3
  • 17
  • And see other links to help with pip install: https://www.makeuseof.com/tag/install-pip-for-python/ and https://pip.pypa.io/en/stable/installing/ – Wellington1993 Nov 28 '18 at 16:33
7

2021 update:

  • easy_install no longer exists, it was replaced by pip install.

  • setuptools is built-in with Python 3. It's the package to read package files (wheels) and do things under the hood.

  • pip is built-in with Python 3.

  • venv is built-in with Python 3.

Some operating systems (Debian) like to split packages into smaller independent packages, you may have to sudo apt-get install python3 python3-pip python3-venv to get all the executables. Nonetheless, the tools are usually available even if the command isn't exposed, try calling python3 -m pip install ....

user5994461
  • 5,301
  • 1
  • 36
  • 57
6
apt-get install python-setuptools python-pip

or

apt-get install python3-setuptools python3-pip

you'd also want to install the python packages...

Ryabchenko Alexander
  • 10,057
  • 7
  • 56
  • 88
Boschko
  • 367
  • 5
  • 14
3

Give this link a try --> https://pypi.python.org/pypi/setuptools

I'm assuming you're on Windows (could be wrong) but if you click the green Downloads button, it should take you to a table where you can choose to download a .exe version of setuptools appropriate for your version of Python. All that eggsetup stuff should be taken care of in the executable file.

Let me know if you need more help.

Bobby
  • 1,062
  • 9
  • 9
2

On Ubuntu until python-distribute is something newer than 0.7 I'd recommend:

$ wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -O - | sudo python

See http://reinout.vanrees.org/weblog/2013/07/08/new-setuptools-buildout.html

Wernight
  • 36,122
  • 25
  • 118
  • 131
1

For Amazon Linux AMI

yum install -y python-setuptools 
Franke
  • 1,234
  • 12
  • 14
0

If you are installing from distro packages, then this probably doesn't apply to your scenario...

recompile python

I have multiple versions of Python built from source installed, and I found I didn't have setuptools for version 3.5. It seems like I was missing the zlib libraries when I compiled 3.5, which subsequently made the setuptools install fail quietly (to me at least). Recompiling with the zlib libs installed fixed this for me.

install from GitHub

If you are for some reason missing setuptools and have Python compiled with all the necessary libs, you should be able to install it from the GitHub repo like this:

git clone https://github.com/pypa/setuptools.git
cd ./setuptools
python3.5 bootstrap.py
sudo python3.5 setup.py install
ryanjdillon
  • 17,658
  • 9
  • 85
  • 110
  • ^This right here should be the top comment. Unfortunately, effective as of April 2018, `python-setuptools` no longer ships with `easy_install`, as per Matthias's update: https://ubuntu.pkgs.org/18.04/ubuntu-main-i386/python-setuptools_39.0.1-2_all.deb.html However, you can still compile from the source code yourself, and it does work. I just tried it with `sudo easy_install shodan`, and it ran successfully. – Kourosh Taheri-Golvarzi Dec 08 '19 at 20:04