16

Easy_install and Pip doesn't work anymore on python 2.7, when I try to do:

sudo easy_install pip

I get:

Traceback (most recent call last):
  File "/usr/bin/easy_install", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/bin/lib/python2.7/site-packages/distribute-0.6.19-py2.7.egg/pkg_resources.py", line 2713, in <module>
    parse_requirements(__requires__), Environment()
  File "/usr/bin/lib/python2.7/site-packages/distribute-0.6.19-py2.7.egg/pkg_resources.py", line 584, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: distribute==0.6.15

And when I try:

sudo pip install [package]

I get:

Traceback (most recent call last):
  File "/usr/bin/pip", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/bin/lib/python2.7/site-packages/distribute-0.6.19-py2.7.egg/pkg_resources.py", line 2713, in <module>
    parse_requirements(__requires__), Environment()
  File "/usr/bin/lib/python2.7/site-packages/distribute-0.6.19-py2.7.egg/pkg_resources.py", line 584, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: pip==0.8.2

I've already install both of them (and yes, first deleted them), but no result...

Thanks!

(I tried already this post)

James Wierzba
  • 16,176
  • 14
  • 79
  • 120
Francis Michels
  • 527
  • 3
  • 7
  • 14

6 Answers6

35

I had this issue where python's distribute package wasn't installed for some reason. After following the instructions on python-distribute, i got it working.

install the distribute package as follows:

$ wget https://web.archive.org/web/20100225231201/http://python-distribute.org/distribute_setup.py
$ python distribute_setup.py

EDIT: http://python-distribute.org/distribute_setup.py no longer works:

hopefully this will resolve your problem with running

$ sudo easy_install

Happy Coding!

Fydo
  • 1,396
  • 16
  • 29
  • That solve my issue as well.. now i can simple install anything using easy_install .. PIP .. bye bye :) – UberNeo Jan 06 '14 at 22:45
  • @UberNeo, Don't get carried away. Pip still has it's advantages! Failed installs won't leave your machine in a dirty state, and pip has an uninstall option too. – Fydo Jan 07 '14 at 17:17
  • Solved for me too (Ubuntu 14.04). – Colby Blair Jul 30 '14 at 14:50
  • python-distribute.org is MIA. – Elijah Lynn Mar 03 '15 at 21:12
  • Thanks for pointing that out. There another copy located at: `https://gist.githubusercontent.com/anonymous/947191a4635cd7b7f79a/raw/36054b7f8d7b0c4c172628fd9bd16f46e53bb34b/distribute_setup.py` just replace the `http://python-distribute.org/distribute_setup.py` in my answer – Fydo Mar 04 '15 at 19:04
  • if you absolutely need `distribute_setup.py`, looks like there's a nightly you can find on: https://pypi.python.org/pypi/distribute/0.6#distribute-setup-py – Fydo Feb 03 '17 at 15:55
18

If you installed a new version of easy_install through Distribute, the new command may have been installed in another directory, most likely /usr/local/bin/. But the traceback shows you were using /usr/bin/easy_install. Try this:

sudo /usr/local/bin/easy_install ...
Ned Deily
  • 83,389
  • 16
  • 128
  • 151
9

Try

  sudo easy_install Distribute 

and if that exists, but is too old

  sudo easy_install -U Distribute

Looks like either Distribute/setuptools (it's old name) is messed up or Python package settings. If either of these do not help, try removing the full Python 2.7 installation and reinstall everything from the scratch.

Possible reasons for the mess is that you have used both sudo easy_install / sudo pip and Linux distribution packages to mix and match system-wide installation packages. You should use virtualenv instead if you use pip/easy_install (no sudo needed)

http://pypi.python.org/pypi/virtualenv

Mikko Ohtamaa
  • 82,057
  • 50
  • 264
  • 435
  • 3
    Always virtualenv on package-based Linux distributions! http://workaround.org/easy-install-debian – Federico Jul 08 '12 at 14:29
  • Also please note that now setuptools package is being upgraded again, Distribute fork is deprecated, so the command would be easy_install -U setuptools. – Mikko Ohtamaa Sep 16 '13 at 12:53
  • @Timmmm i m facing the same issue. i forgot where i saw the instruction on removing python 2.7...how did you fix it? thanks! – trillions Sep 26 '13 at 21:40
0

I had a similar problem, but things were working fine as root. In my case, I found that the permissions on the python packages were not readable by the ID I was running the command under.

To correct it, I ran the following command to open the permission for read and execute to all users:

sudo chmod o+rx -R /usr/local/lib/python2.7/dist-packages/*.egg
iDurocher
  • 875
  • 9
  • 11
0

I had similar issue when trying to install package via pip with python 3.6 on windows. (pip is supposed to work out of the box with this install)

The problem was not running as administrator.

Running cmd as administrator and then installing my package worked:

python -m pip install pylint

James Wierzba
  • 16,176
  • 14
  • 79
  • 120
0

I was trying to get pip to work on the 2.7.0 version, but it seems like it doesn't come with the easy_install/pip files (Script folder in main directory), installing 2.7.13 solved the problem for me.