Reputation: 23715
On OSX 10.7.5, I'm trying to use the pip3
command to install packages to python3. When I try, I get this error message:
zak$ pip3
Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/setuptools-1.0-py3.3.egg/pkg_resources.py", line 2793, in <module>
File "/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/setuptools-1.0-py3.3.egg/pkg_resources.py", line 673, in require
File "/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/setuptools-1.0-py3.3.egg/pkg_resources.py", line 580, in resolve
pkg_resources.VersionConflict: (pip 1.4.1 (/usr/local/lib/python3.3/site-packages), Requirement.parse('pip==1.3.1'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 5, in <module>
from pkg_resources import load_entry_point
File "<frozen importlib._bootstrap>", line 1567, in _find_and_load
File "<frozen importlib._bootstrap>", line 1534, in _find_and_load_unlocked
File "/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/setuptools-1.0-py3.3.egg/pkg_resources.py", line 2797, in <module>
File "/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/setuptools-1.0-py3.3.egg/pkg_resources.py", line 576, in resolve
pkg_resources.DistributionNotFound: pip==1.3.1
It looks like setuptools
is demanding an old version of pip (I have 1.4.1 installed), but why? How can I fix this?
Upvotes: 3
Views: 6101
Reputation: 2673
It seems this was caused by a broken Python installation, I was able to fix it by reinstalling Python with Homebrew.
brew reinstall python3
Upvotes: 0
Reputation: 4254
After running
pip install --upgrade setuptools
I was able to fix it. But this may not be true for everyone for I am still learning Python.
Upvotes: 0
Reputation: 365925
The problem appears to be that you have two different Python 3.3 installations, and a shared site-packages directory.* And the tool you run as pip3
is from pip 1.3.1, but the modules it uses to do its work come from pip 1.4.1.
The easiest way to solve this, unless you actually need both Python 3.3 installations, is to get rid of both of them completely, then reinstall the one you want.
The following should work (possibly with sudo
for some of the commands—or using Finder and letting it tell you whether you need to authenticate).
Note that this will also partially or completely remove any other third-party Python versions (e.g., a python.org 2.7.5), which I don't think is a problem for you, but could be for future readers.
You might want to make a list of all installed packages before uninstalling anything. (I usually do this in the hackiest way possible: fire up ipython
, and let it tab-complete an import statement…)
Finally, some of these details will be different for any future readers with similar problems, but the basic ideas should be the same.
brew uninstall python3
rm -rf /Library/Frameworks/Python.framework
rm -rf /usr/local/lib/python*
rm -rf /usr/local/share/python*
~/.bash_profile
(or ~/.profile
or elsewhere) you add the Python paths to your PATH. You may have /usr/local/share/python3
and/or something inside the Python.framework
or Cellar/python3
. Scrap all that you find.brew doctor
, and fix anything that it complains about that seems potentially relevant (the non-Homebrew MacFUSE stuff is fine as-is; the brew prune
suggestion is probably worth doing, but doesn't matter here), and run it again to make sure.brew install python3
.pip3
to reinstall any packages you deleted that you need again.* Details:
/usr/local/Cellar/python3/3.3.2/
, with various things symlinked into /usr/local/bin
and its siblings, and possibly into /Library
somewhere./Library/Frameworks/Python.framework/Versions/3.3/
, with various things possibly symlinked into /usr/local/bin
or otherwise added to your PATH./usr/local/lib/python3.3
in their site-packages search.Upvotes: 2