Dealing with Python Package Install Errors on Older Ubuntu Distros

Sohail Abbasi
2 min readMar 4, 2021

I must confess, this story erupted out of utter frustration. First the thought that I was completely out of my depth and that crossing 40 had put me utterly unable to deal with seemingly easy problems that I’d taken care of in a jiffy. It turned out it wasn’t my dead brain cells after all. All the strange errors I’d been getting stemmed from the silly behavior of the pip package installer that comes bundled with Ubuntu.

As most of us know we can install python v3 and its associated package manager conveniently through apt using:

apt install python3 python3-pip

These are usually comparatively older versions than what can be found on the internet. This is not necessarily a problem as changes to the python specification are rarely needed to run programs from the internet or by python packages. However, we are stuck with the legacy version of pip and that can hurt you bad as I found out in this instance.

So if you are getting these strange errors where your package requirements are not being resolved to an acceptable list of packages or you are getting errors where packages installing correctly before are now giving you errors that they require a higher version of a python package, the solution may be as simple as updating your pip package manager. In order to do that, all you need to do is to issue the command:

python3 -m pip install -U pip

The only downside with that is that you can no longer use the pip3 command; instead use the pip package through the module command. e.g. to install all requirements in a requirements.txt file you would say:

python3 -m pip install -r requirements.txt

Will hopefully save you a lot of headaches and sleepless nights. Cheers!

--

--

Sohail Abbasi

The Ultimate Maverick. Looking to contribute something significant to the world while I live