Pip Install Keeps Failing :(

Hey guys, I’m on the “Modules” section trying to install pip, and I’m having a lot of trouble.
I think it has something to do with the fact that when I check what version of Python I have it says I have 2.7.16:

Sapphos-MacBook-Pro:~ sappho$ python --version

Python 2.7.16

But when I check for Python3, it correctly says I have 3.8.3.

Sapphos-MacBook-Pro:~ sappho$ python3 --version

Python 3.8.3

So it looks like I have both installed. Anyway, I try to install pip and it correctly downloads, things look good until…

Sapphos-MacBook-Pro:~ sappho$ sudo easy_install pip

Searching for pip

Reading https://pypi.org/simple/pip/

Downloading (https://)files.pythonhosted.org/packages/fe/3b/0fc5e63eb277d5a50a95ce5c896f742ef243be27382303a4a44dd0197e29/pip-20.2b1-py2.py3-none-any.whl#sha256=b4e230e2b8ece18c5a19b818f3c20a8d4eeac8172962779fd9898d7c4ceb1636

Best match: pip 20.2b1

Processing pip-20.2b1-py2.py3-none-any.whl

Installing pip-20.2b1-py2.py3-none-any.whl to /Library/Python/2.7/site-packages

Adding pip 20.2b1 to easy-install.pth file

Installing pip script to /usr/local/bin

Installing pip3.8 script to /usr/local/bin

Installing pip3 script to /usr/local/bin

Installed /Library/Python/2.7/site-packages/pip-20.2b1-py2.7.egg

Processing dependencies for pip

Finished processing dependencies for pip

Sapphos-MacBook-Pro:~ sappho$ pip --version

pip 20.2b1 from /Library/Python/2.7/site-packages/pip-20.2b1-py2.7.egg/pip (python 2.7)

… it ends up in the Python 2.7 folder instead of the 3.8 folder. In the “Learn Python: Pipenv” video it says that you need pip to work for Python 3 in order for subsequent steps to work, but when I try to upgrade pip, this happens:

Sapphos-MacBook-Pro:~ sappho$ sudo pip install --upgrade pip

DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support

WARNING: The directory '/Users/sappho/Library/Caches/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

Requirement already up-to-date: pip in /Library/Python/2.7/site-packages/pip-20.2b1-py2.7.egg (20.2b1)

I’m checked and I am definitely an administrator, plus I’m the only user on my computer, so… what gives? I just got into coding a month ago and as far as I know, I have no need for Python 2. How can I remove Python 2 from my life, and get pip to just install for Python 3 so I can move on with this course

Thank you so much for your help, I know this might’ve been an awkward read with all the pasted code, but thank you for powering through and I look forward to reading any comments <3 :frowning_face:

For Python3, you want pip3.

And while you may want to use Python3 and not Python2, don’t remove Python2 as your OS may have some dependencies if it was pre-installed.

1 Like

@script6564767895: In addition to what @harrjt has mentioned, ensure that you have Python added to your PATH variable.

That is so helpful and obvious in hindsight haha! Thanks so much, you’re a lifesaver

Ok, cool! Thanks so much!