Time for Python 2 users to make sure we have a copy of Pip and other pieces

January 25, 2021

The news of the time period is that as the Pip developers said they would, the just released Pip 21.0 has dropped support for Python 2 (via). In theory this doesn't matter for modern users of Python 2.7, because Python itself should ship with a bundled version of pip so that you don't have to install one from scratch. In practice, some Linux distributions split the pip command off into a separate sub-package and no longer make a Python 2 version available, although they continue to ship Python 2 itself for legacy uses (this is the case in Fedora 32 and later). Now that Pip no longer supports Python 2, I wouldn't be surprised if more Linux (and Unix) distributions did this, because Pip's change means that they need to ship two different versions of Pip.

The release of Pip 21.0 and all of this has made me realize that now is a good time for us (and for all Python 2 users) to make sure that we have our own working copy of Pip, quite possibly the latest one. This is unfortunately now more difficult than it used to be just a week or two ago, because the special get-pip.py bootstrap Python program is now Pip 21.0, and so won't work with Python 2 any more. Fortunately you can still find the older version of get-pip.py for Python 2.7. You might want to save a copy, or go all the way to making a '--user' install of the Python 2 pip in some user account and saving the .local/lib/python2.7/site-packages/pip and other artifacts that you get. To the best of my knowledge they can be moved around freely between systems.

Of course, Pip itself relies on the Python Package Index (PyPI). My understanding is that PyPI has not made any announcements about dropping support for Python 2 packages or for Python 2 versions of pip fetching packages, but I wouldn't count on either being available forever. If you have additional dependencies for your Python 2 programs, it's probably a good time to make sure you have local copies of them. This especially includes dependencies that you get through packages provided by your Linux distribution (for example as Ubuntu packages), because pretty much every Linux distribution will be dropping most or all of their additional Python 2 packages soon (if they haven't already).

(If nothing else, someday PyPI may change its API in a way that requires changes to Pip and other programs that talk to it.)

I also wouldn't be surprised if Pip's move prompts more third party Python packages to drop support for Python 2, which is of course a movement that's been going on for some time now. Presumably this doesn't matter much to most Python 2 people, who have probably already more or less frozen their package versions.

(Fortunately we have very little to worry about. I believe that almost all of our remaining Python 2 code uses only built in modules, not third-party packages. Our major consumer of third party packages is already a Python 3 program.)

PS: While PyPy is going to provide a Python 2.7 implementation for the foreseeable future, I wouldn't count on the rest of the Python ecosystem to support it (Pip included, obviously). People who use the Python 2 PyPy, perhaps someday including us, will be on their own.

Written on 25 January 2021.
« Your monitoring and alerts remember things for you
find mostly doesn't need xargs today on modern Unixes »

Page tools: View Source, Add Comment.
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Mon Jan 25 22:43:05 2021
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.