Easy_install and pip broke: pkg_resources.DistributionNotFound: distribute==0.6.36
Asked Answered
S

8

46

I was tried to upgrade pip with pip install --upgrade pip on OSX and pip and easy_install both dont work.

When running pip

Traceback (most recent call last):
  File "/usr/local/bin/pip", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.49-py2.7.egg/pkg_resources.py", line 2881, in <module>
    parse_requirements(__requires__), Environment()
  File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.49-py2.7.egg/pkg_resources.py", line 596, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: pip==1.3.1

When running easy_install

  File "/usr/local/bin/easy_install", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.49-py2.7.egg/pkg_resources.py", line 2881, in <module>
    parse_requirements(__requires__), Environment()
  File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.49-py2.7.egg/pkg_resources.py", line 596, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: distribute==0.6.36

How can I fix this?

UPDATE I found the solution.

I did cd /usr/local/lib/python2.7/site-packages && ls

found pip-1.4.1-py2.7.egg-info and distribute-0.6.49-py2.7.egg in the directory.

Then the following steps fixed the issue.

  1. Changed the pip version to 1.4.1 in /usr/local/bin/pip

  2. Changed distribute version to 0.6.49 in /usr/local/bin/easy_install


The answers on other such questions to curl ez_setup.py and install setuptools from it didnt work. It gave the following error.

Downloading https://pypi.python.org/packages/source/s/setuptools/setuptools-1.1.6.tar.gz
Traceback (most recent call last):
  File "<stdin>", line 370, in <module>
  File "<stdin>", line 366, in main
  File "<stdin>", line 278, in download_setuptools
  File "<stdin>", line 185, in download_file_curl
  File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 542, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['curl', 'https://pypi.python.org/packages/source/s/setuptools/setuptools-1.1.6.tar.gz', '--silent', '--output', '/usr/bin/setuptools-1.1.6.tar.gz']' returned non-zero exit status 23
Siloxane answered 16/10, 2013 at 9:58 Comment(1)
Thanks for the fix, I thought having 1.4 in the /usr/bin/pip file was enough... no, it had to be 1.4.1.Variometer
N
9

If you do this then it will work:

cd /usr/local/lib/python2.7/site-packages && ls

Find pip-1.4.1-py2.7.egg-info and distribute-0.6.49-py2.7.egg in the directory.

Then the following steps fixed the issue:

  • Changed the pip version to 1.4.1 in /usr/local/bin/pip
  • Changed distribute version to 0.6.49 in /usr/local/bin/easy_install
Nightjar answered 26/10, 2013 at 11:13 Comment(3)
what if i don't find them?Chowchow
How do you "change the version" of an installed egg/binary?Mismate
I agree with @Mismate - any solution that involves editing version numbers in distribution files by hand is deeply suspicious.Strickler
S
75

Install the distribute package as follows:

$ wget https://svn.apache.org/repos/asf/oodt/tools/oodtsite.publisher/trunk/distribute_setup.py
$ python distribute_setup.py

You will have a working easy_install then.

Happy Coding.

Statampere answered 16/10, 2013 at 10:13 Comment(9)
This was helpful in fixing another pkg_resources.DistributionNotFound problem. Thanks so much!! Why is this the solution? What is distribute?Respectable
I also ran into this same problem after upgrading to OS X Mavericks. I found that I needed to run python distribute_setup.py via sudoRespectable
ran into this same problem after upgrading to OS X Mavericks; but this fix did not work for me.Ordain
This web page for the script is not available.Molehill
After 50,000 other answers that never addressed my problem, you have solved something that has been plaguing me for months. If I could take all of my SO points and give them to you... I wouldn't. But I would at least give you 10 or so.Iconography
This was a huge help to me just now! Thank you. Fix worked for me, also required sudo (on OS X Mavericks) to change system pathsKoller
In my case there is a new error when I try to install a package via pip: File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1260, in prepare_files )[0] ... IndexError: list index out of rangeFetterlock
From the Distribute page: 'Distribute' is a now deprecated fork of the 'Setuptools' project. I suppose you should install setuptools instead?Mismate
It definitely worked! I've also seen the Deprecation notice, but setuptools will not work on my system (without deep digging). This is a very useful answer.Dawes
T
17

None of the other answers worked for me. It was much simpler with these instructions. I had installed an extra copy of easy_install at /usr/local/bin/easy_install and /usr/local/bin/easy_install-2.7. I am pretty sure I did so following instructions here and in other places. The solution for me was to delete these two instances:

rm /usr/local/bin/easy_install
rm /usr/local/bin/easy_install-2.7

and then reinstall pip with

sudo easy_install --upgrade pip

Some background: I got to this point after having to reinstall OSX.

Tammietammuz answered 3/5, 2014 at 3:25 Comment(5)
How can you run easy_install after deleting them?Gale
@xPino because the ones that were deleted aren't the ones the system uses and were just getting in the way. Follow the link in my answer to learn more.Tammietammuz
@xPino aww dang, that sucks. Sorry it didn't work for you. If this SO question is any indication there are a lot of ways how a person could end up in this situation. I think you and I ended up here in different ways. If I was in your position I would try following directions for completely reinstalling setuptools.Tammietammuz
Actually just running the command sudo easy_install --upgrade pip solved the issue for me!Alienation
Be careful deleting these commands from /usr/local/bin - they might have been put there by installing things in a virtualenv, and you will only realise this later!Traumatize
N
9

If you do this then it will work:

cd /usr/local/lib/python2.7/site-packages && ls

Find pip-1.4.1-py2.7.egg-info and distribute-0.6.49-py2.7.egg in the directory.

Then the following steps fixed the issue:

  • Changed the pip version to 1.4.1 in /usr/local/bin/pip
  • Changed distribute version to 0.6.49 in /usr/local/bin/easy_install
Nightjar answered 26/10, 2013 at 11:13 Comment(3)
what if i don't find them?Chowchow
How do you "change the version" of an installed egg/binary?Mismate
I agree with @Mismate - any solution that involves editing version numbers in distribution files by hand is deeply suspicious.Strickler
B
6

Wich operative system ?

Anyways you should try to do this:

sudo easy_install -U distribute

Maybe this is helpfull too, whit this you install easy_install-2.7:

wget --no-check-certificate http://pypi.python.org/packages/source/d/distribute/distribute-0.6.35.tar.gz
tar xf distribute-0.6.35.tar.gz
cd distribute-0.6.35
python2.7 setup.py install

Maybe you need to force an update, or reinstall easy_install, because it seems is your problem.

Bloomer answered 16/10, 2013 at 10:1 Comment(2)
What worked for me is to re-install the distribute package via the easy_install at /usr/bin instead of /usr/local/bin: sudo /usr/bin/easy_install -U distributeDelaryd
=distribute= is now deprecated - it was a fork of =setuptools=.Traumatize
A
4

Just Pointing it out here once again to make the solution more obvious!

Just running the command sudo easy_install --upgrade pip solved the issue for me!

Alienation answered 5/1, 2016 at 12:16 Comment(0)
W
1

It seems that pip was installed with reference to a new version of python, while your active python executable is still old. In case you want to keep the older version of python, it's pretty straightforward: reinstall pip using the old version.

  1. Get the get-pip.py file which is linked from https://pip.pypa.io/en/stable/installing/
  2. Using the old version of python executable (I assume it should be the python command), run the script.

If you're looking for a shortcut: cd /tmp/ && wget https://bootstrap.pypa.io/get-pip.py && sudo python get-pip.py

The script removes old versions of pip and properly installs a new executable, linking to the old python's executable environment.

Withdrew answered 4/7, 2016 at 19:55 Comment(0)
R
1

I was in the middle of migrating from OSX system python to homebrew python, and was having the same error. Upgrading the homebrew python version (running brew upgrade python) did the thing for me.

Reims answered 29/10, 2016 at 11:11 Comment(0)
D
0

One way to solve distributeNotFound error is to download the python module with exact version. Uncompress it, go to the folder and install it "python setup.py install". Then, may be upgrade it to the latest version.

I had the error 'pkg_resources.DistributionNotFound: The 'setuptools==19.4' distribution was not found and is required by the application'. I downloaded setuptools v 19.4, when v 36.2.7 is already out. I installed v 19.4 and then upgraded with command "easy_install --upgrade setuptools'. Everything worked like charm thereafter.

Dementia answered 16/8, 2017 at 15:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.