Member-only story

What To Do When Pip Install Fails You

Liu Zuo Lin
2 min readAug 22, 2021

--

It happens. We might be migrating to a new computer, reinstalling Python for whatever reason and so on, and wish to install our favourite Python libraries, and pip just doesn’t work.

I’ve not faced this problem myself, but as a Python tutor, I’ve spent more time solving this problem for new students that I would have liked to. Life is too short to be spend a disproportionate amount of time debugging this, so to save our collective time, here’s a bunch of workarounds for this issue!

Using Python’s -m flag

python -m pip install something

One potential reason why Pip isn’t working could be that Python is in your PATH, but not Pip for some reason. As such, we can use Python’s -m flag as a workaround to execute pip through Python.

# some Windows computers
python -m pip install something
# other Windows computers
py -m pip install something
# MacOS
python3 -m pip install something

Installing pip using get-pip.py

If the method above does not work, your Python installation probably doesn’t have pip installed. Here’s a workaround — download the Python script from the link below

--

--

Liu Zuo Lin
Liu Zuo Lin

Written by Liu Zuo Lin

SWE @ Meta | [Ebook] 101 Things I Never Knew About Python: https://payhip.com/b/vywcf

No responses yet