Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

Pip3 from Python3 upgrade will break Pip from Python #25752

Closed
cclauss opened this issue Jan 9, 2014 · 9 comments
Closed

Pip3 from Python3 upgrade will break Pip from Python #25752

cclauss opened this issue Jan 9, 2014 · 9 comments
Labels

Comments

@cclauss
Copy link
Contributor

cclauss commented Jan 9, 2014

Under the current installs, if you do:
pip install --upgrade pip
Followed by:
pip3 install --upgrade pip
Then you do:
pip -V
You will see that both pip and pip3 point to the Python3 pip and the only way to use the Python 2 pip is to use pip2 instead of pip. Reversing the order of the install --upgrade pip commands will deliver the desired result.

Python 3.4 (expected GA date 16 March) should reduce these woes because it will embed pip in the Python3 distribution.

@matthewrankin
Copy link

@cclauss Even when I reverse the order of the install --upgrade pip commands, pip still points to the Python3 pip.

I tried the following, but it didn't solve the problem:

pip3 install --force-reinstall --upgrade pip
pip install --force-reinstall --upgrade pip

To solve the problem, I had to run:

pip3 install --upgrade pip
pip2 install --upgrade pip

That left me with pip pointing to the Python2 site-packages.

$ pip3 -V
pip 1.5.2 from /usr/local/lib/python3.3/site-packages (python 3.3)
$ pip2 -V
pip 1.5.2 from /usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (python 2.7)
$ pip -V
pip 1.5.2 from /usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (python 2.7)

@cclauss cclauss closed this as completed Feb 14, 2014
@cclauss cclauss reopened this Feb 14, 2014
@adamv
Copy link
Contributor

adamv commented Feb 22, 2014

Possibly fixed by ddad99c

@adamv adamv closed this as completed Feb 22, 2014
@joergrathlev
Copy link
Contributor

This is not fixed (or maybe it used to be fixed and it's a regression).

Steps to reproduce:

My first attempt to repair this broke something, so I first completely removed my existing Python installations (this should hopefully be obvious, but don't run these commands unless you know what to re-install later):

$ brew uninstall python
$ brew uninstall python3
$ rm -rf /usr/local/lib/python2.7/site-packages
$ rm -rf /usr/local/lib/python3.4/site-packages

Then I re-installed both versions of Python, starting with Python 2.7:

$ brew install python
$ pip install --upgrade pip setuptools
$ brew install python3
$ pip3 install --upgrade pip setuptools

Now both pip and pip3 were linked to the Python 3 version:

~$ pip --version
pip 7.0.1 from /usr/local/lib/python3.4/site-packages (python 3.4)
~$ pip3 --version
pip 7.0.1 from /usr/local/lib/python3.4/site-packages (python 3.4)

I could restore the pip command to Python 2.7 by forcing a reinstall via the pip2 command, as suggested by @matthewrankin (thanks!):

~$ pip2 install --upgrade --force-reinstall pip
~$ pip --version
pip 7.0.1 from /usr/local/lib/python2.7/site-packages (python 2.7)
~$ pip3 --version
pip 7.0.1 from /usr/local/lib/python3.4/site-packages (python 3.4)

@yangj1e
Copy link
Contributor

yangj1e commented Jun 28, 2015

This is not fixed.
+1

@DomT4
Copy link
Member

DomT4 commented Jun 28, 2015

This remains a known issue, yes. @tdsmith has commented on it before in several newer issues, but the gist I believe is that we can't do anything about it very practically sadly.

@cclauss
Copy link
Contributor Author

cclauss commented Jun 28, 2015

Python3.rb could run pip -V which would show if 1) pip is installed and 2) if pip pointed to a Python2 library. If both of those conditions are True then the .rb should not install over pip but should only install a pip3.

@DomT4
Copy link
Member

DomT4 commented Jun 28, 2015

This isn't a Homebrew formula issue per se.

The Python3 formula does not override pip in HOMEBREW_PREFIX/bin. The part that overrides pip is when a user manually runs a pip3 install --upgrade pip and that logic is handled by pip itself rather than Homebrew or the Python3 formula.

@cclauss
Copy link
Contributor Author

cclauss commented Jun 28, 2015

Ahh.... Thanks for the explication. I get it now.

@joergrathlev
Copy link
Contributor

Thanks @DomT4 for the explanation. I agree that it's not a Homebrew issue, then.

@Homebrew Homebrew locked and limited conversation to collaborators Feb 17, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants