Python pip broken after OS X 10.8 upgrade
Made the upgrade to Mac OS X 10.8 (Mountain Lion) and get now the following error when trying to call $ pip
:
Traceback (most recent call last):
File "/usr/local/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in <module>
working_set.require(__requires__)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require
needed = self.resolve(parse_requirements(requirements))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
raise DistributionNotFound(req) # XXX put more info here
pkg_resources.DistributionNotFound: pip==1.1
Update: Tried to reinstall by doing the install procedure again (with http://www.pip-installer.org/en/latest/installing.html#using-the-installer and easy_install
), but didn't work, got the same error.
Tried now the following: Calling $ sudo pip
and the above error disappears. Strange is, that the directories which could not befound in the above error message point to /System/Library/... while the python installation is (new ?) to find in /Library/Frameworks/..:
$ which python
/Library/Frameworks/Python.framework/Versions/Current/bin/python
Any idea how to get rid of the sudo?
Asked by: Richard828 | Posted: 06-12-2021
Answer 1
Use easy_install
to update your pip
to the latest version:
sudo easy_install -U pip
Also make sure you have the lastest XCode
installed (ver 4.4) with Command Line Tools
.
Answer 2
This works for me
rm -f /usr/local/bin/easy_install
brew reinstall python
pip install --upgrade setuptools
pip install --upgrade pip
Answered by: William572 | Posted: 07-01-2022
Answer 3
I had a similar error except that sudo pip
did not work either. I am using a "brew" installation of python (which is symlinked to /usr/local/bin) and found that the problem was that the shebangs in the pip and easy_install files were hardcoded to #!/usr/bin/python
instead of #!/usr/local/bin/python
, and so was using the system python version instead of the brew version.
Cheers, Tom
Answered by: Freddie474 | Posted: 07-01-2022Answer 4
I actually couldn't do what was suggested. I instead had to execute:
xcode-select --install
Then I was able to install the ldap module.
Answered by: Brooke823 | Posted: 07-01-2022Answer 5
I tried all the answers here, from reinstall easy_install to install a new python version, nothing worked for me.
What I did was install a fresh Python install in the /Library/Frameworks folder, and symlink to that one from /usr/local/bin (for some reason, my system had a symlink from /Library/Frameworks/Python.framework to /System/Frameworks/Python.framework). My idea was to keep the /System/Library/Frameworks files to be used by system commands in /usr/bin, and have /usr/local/bin points to another "user land" install in /Library/Frameworks. In order to do that :
rename /System/Library/Framework/Python.framework into _OLD_Python.framework
delete every python file in /usr/local/bin (using sudo rm /usr/local/bin/python*) and /usr/local/bin/pip* (but do NOT touch /usr/bin)
Reinstall python from the official site (http://www.python.org/getit/) ==> This will reinstall python in /Library/Framework and not /System/Library/Framework
Then launch the Applications/Python/Update Shell Profile.command command that will make sure your path is using that one
Then recreate the symlinks in /usr/local/bin using
ln -s ../../Library/Frameworks/Python.framework/Versions/2.7/bin/python python
Finaly, rename the _OLD_Python.framework back to Python.framework (because that's the path /usr/bin/python points to)
Typing "which python" should point to /Library/... and not /System/Library. From there you should be able to reinstall easy_install and pip properly.
Answered by: Julian935 | Posted: 07-01-2022Answer 6
Rather than change ownership, it is possible to simply change permissions:
$ sudo chmod -R o+rX /Library/Python/2.7/site.packages
Answered by: Julian527 | Posted: 07-01-2022Answer 7
On Mavericks, I found that
ls -l `which python`
/usr/local/bin/python -> ../../../Library/Frameworks/Python.framework/Versions/2.7/bin/python
while pip showed
ls -l `which pip`
/usr/local/bin/pip
I renamed the old pip
and created a symlink to the proper pip binary, and now all is well. It's probably not the best solution, but it works.
Answer 8
I fixed this by reinstalling python with homebrew: brew install python
Answer 9
I changed the permissions for Python folder (from root to my user), and now everything work for me:
sudo chown -R <your_user>:wheel /Library/Python/2.7/site-packages/
Not recommended for machines with multiple users.
Answered by: Charlie350 | Posted: 07-01-2022Answer 10
I usually had same issue with some project referencing bonjour-py
in their requirements.txt
, didn't know which or how to track that one at the moment.
And someone told me that pip-tool. It's actually a great alternative to identify which you have, and if you want to update them. And as a bonus it ignored well the bonjour-py
error.
Similar questions
Python broken on upgrade from Ubuntu 12.04 to 14.04
Hi I am trying to update Ubuntu 12.04 LTS to 14.04 LTS via "do-release-upgrade" but still got:
2016-08-18 18:40:08,938 INFO apt version: '0.8.16~exp12ubuntu10.27'
2016-08-18 18:40:08,938 INFO python version: '2.7.12 (default, Jul 18 2016, 14:59:49)
[GCC 4.6.3]'
2016-08-18 18:40:08,939 INFO release-upgrader version '0.220.3' started
2016-08-18 18:40:08,940 INFO locale: 'en_US' 'UTF-8'
2016-08-18 18:40:08,99...
How do I upgrade python 2.5.2 to python 2.6rc2 on ubuntu linux 8.04?
I'd like to how to upgrade the default python installation(2.5.2) supplied with ubuntu 8.04 to python 2.6rc2. I'd like to make 2.6 the default python version on the system and migrate all the other useful installed python libraries installed on 2.5.2 to python 2.6rc2. Please let me know how I can achieve this.
Thanks
Dirk
macos - Upgrade Python to 2.6 on Mac
I'd like to upgrade the default python installation (2.5.1) supplied with OS X Leopard to the latest version. Please let me know how I can achieve this.
Thanks
macos - Trying to upgrade Python to 3.0 on Mac OS 10.5.8
I'm having some problems upgrading Python on my Mac. For my first attempt, I downloaded and installed the 2.6.4 dmg MacPython installer from http://python.org/download/mac/. This did install 2.6.4, and when I ran 'python' from the terminal it says that version.
However, I also had a test script where I am doing:
import os, json
...
Upgrade python to 2.7 and Django to 1.4, but it tells me No module named *
I have just upgraded my python to 2.7 on my Ubuntu server, and reinstalled the Django to 1.4. I use python flup to run the Django application as fastcgi, but when I try to restart the application, it keeps telling me No module named *
e.g.
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
...
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", l...
upgrade python from 2.4 to 2.6 in plone
I am trying to upgrade my plone version from 3.3.5 to 4.0. For this I went to this site: updating plone. But I got stuck in the first point. In plone 3, I have python version of 2.4. But for plone 4.x I will need python 2.6. How do I upgrade my python version? In my buildout.cfg I have:
python - NumPy won't upgrade from 1.5.1 to 1.6.2 on OS X 10.7
I am attempting to update/upgrade my NumPy, but am failing. I think I might have multiple versions of NumPy installed in different directories, but python by default imports an old one. Any help?
Here's where my Python is:
Gonzo-vs-Kitties:~ brian$ which python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
Here's the version that Python imports:
Gonzo...
Upgrade Python 2.4 to 2.6 or 3.0
I am running Python 2.4 on Redhat Linux 5.
Any idea how to upgrade to either Python 2.6 or 3.0?
Thanks in advance,
Sum
Should I upgrade python 2.7.3 to 2.7.4
The reason I ask is that some of the packages I have installed were specific to 2.7.3 as windows installers from PyPI.
Would these need to be re-installed or would pip update these?
Thanks.
python - Can't upgrade Scipy
I'm trying to upgrade Scipy from 0.9.0 to 0.12.0. I use the command:
sudo pip install --upgrade scipy
and I get all sorts of errors which can be seen in the pip.log file here and I'm unfortunately not python-savvy enough to understand what's wrong. Any help will be appreciated.
python - Upgrade to numpy 1.8.0 on Ubuntu 12.04
I'm running Ubuntu 12.04 which comes by default with NumPy 1.6.0 (I have, actually had, Python 2.7.3 installed). As a result of the answer to this question polyfit() got an unexpected keyword argument 'w', I need to upgrade it.
I downloaded the .tar.gz packa...
How do I upgrade python 2.5.2 to python 2.6rc2 on ubuntu linux 8.04?
I'd like to how to upgrade the default python installation(2.5.2) supplied with ubuntu 8.04 to python 2.6rc2. I'd like to make 2.6 the default python version on the system and migrate all the other useful installed python libraries installed on 2.5.2 to python 2.6rc2. Please let me know how I can achieve this.
Thanks
Dirk
macos - Upgrade Python to 2.6 on Mac
I'd like to upgrade the default python installation (2.5.1) supplied with OS X Leopard to the latest version. Please let me know how I can achieve this.
Thanks
macos - Trying to upgrade Python to 3.0 on Mac OS 10.5.8
I'm having some problems upgrading Python on my Mac. For my first attempt, I downloaded and installed the 2.6.4 dmg MacPython installer from http://python.org/download/mac/. This did install 2.6.4, and when I ran 'python' from the terminal it says that version.
However, I also had a test script where I am doing:
import os, json
...
How to upgrade the version of Python used by Apache?
On a Red hat box, I upgraded Python from 2.3 to 2.6.4 and changed the symlink to python so when I type in python the 2.6.4 interpreter comes up.
However my .py file works from the command-line, but not in the browser. It seemed like a sys.path issue so I opened the file in a browser and printed out sys.path.
Surprisingly, my sys.path is differ...
build - How can I upgrade the sqlite3 package in Python 2.6?
I was using Python 2.6.5 to build my application, which came with sqlite3 3.5.9. Apparently though, as I found out in another question of mine, foreign key support wasn't introduced in sqlite3 until version 3.6.19. However, Python 2.7 comes with sqlite3 3.6.21, so this work -- I decided I wanted to use foreign keys in my application, so I tried upgrading to python 2.7.
I'm using twisted, and I couldn't for the life...
Upgrade python to 2.7 and Django to 1.4, but it tells me No module named *
I have just upgraded my python to 2.7 on my Ubuntu server, and reinstalled the Django to 1.4. I use python flup to run the Django application as fastcgi, but when I try to restart the application, it keeps telling me No module named *
e.g.
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
...
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", l...
upgrade - How to make newest version of Python the default or first in path
I have installed a new version of Python, so I want to make sure when Python is invoked that version is first in my path. So, now on my 'C' drive I have "Python27" and "Python32" (old and new version, respectively).
When I type "python" in the command line I get "Python 2.7". Using control panel I have changed the "path" and "pythonpath" user variables (from 'C:\Python27' to 'C:\Python32') and to be sure I have re...
upgrade python from 2.4 to 2.6 in plone
I am trying to upgrade my plone version from 3.3.5 to 4.0. For this I went to this site: updating plone. But I got stuck in the first point. In plone 3, I have python version of 2.4. But for plone 4.x I will need python 2.6. How do I upgrade my python version? In my buildout.cfg I have:
python - NumPy won't upgrade from 1.5.1 to 1.6.2 on OS X 10.7
I am attempting to update/upgrade my NumPy, but am failing. I think I might have multiple versions of NumPy installed in different directories, but python by default imports an old one. Any help?
Here's where my Python is:
Gonzo-vs-Kitties:~ brian$ which python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
Here's the version that Python imports:
Gonzo...
Upgrade Python 2.4 to 2.6 or 3.0
I am running Python 2.4 on Redhat Linux 5.
Any idea how to upgrade to either Python 2.6 or 3.0?
Thanks in advance,
Sum
Still can't find your answer? Check out these communities...
PySlackers | Full Stack Python | NHS Python | Pythonist Cafe | Hacker Earth | Discord Python