Pip and pip3 commands use the same brew installed version of pip

(Yunti) #1

As per the brew docs for python, pip and pip2 should use python 2 and pip3 python 3

I found I had global pip dependencies which were uneeded (I don’t really use python2) and removed them however these removed the ones listed with pip3

investingating with:
~/P/p/django_test ❯❯❯ pip --version
pip 19.0.3 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)
~/P/p/django_test ❯❯❯ pip3 --version
pip 19.0.3 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)
~/P/p/django_test ❯❯❯ python --version
Python 2.7.15
~/P/p/django_test ❯❯❯ python3 --version
Python 3.7.1
~/P/p/django_test ❯❯❯ python2 --version
Python 2.7.15
~/P/p/django_test ❯❯❯ brew list | grep python

it seems that I somehow have pip and pip3 using the same version of pip

Is this expected behaviour and just undocumented?

(Sean Molenaar) #2

what does which pip show you? And where does python3 come from? because that isn’t in homebrew-core.

(Yunti) #3

~/P/python ❯❯❯ which pip

~/P/python ❯❯❯ which python3

(Robert Blair) #4

I can concur with this issue. I installed python via brew and upgraded pip since it is installed by default with python installations. I have two python installations in macOS, system (2.7.10) and homebrew python (3.7.3). At some point, pip and pip3 have been linked to referencing only the python 3 installation. The only solution I’ve found for pip to be reverted back to referencing the system python was to initiate the installation of pip with get-pip.py. However, I wonder if this will break again after updating either pip, packages, python, or the OS. Also, I can’t say that using pip vs pip3 has any difference when installing packages which are reliant on python version 2 or 3. It maybe that it’s dependent on the development environment. I only have been playing around with python 3 and haven’t touched the system installed version. So, this could be the reason that pip and pip3 point to python 3.