Python 2, Apache's mod_wsgi, and its future in Linux distributions

January 19, 2020

Sometimes I have small questions about our future with Python 2, instead of big ones. Our Django web application currently runs in Apache using mod_wsgi, and the last time we attempted a Django upgrade (which is a necessary step in an upgrade to Python 3), it didn't go well. This means that we may wind up caring quite a bit about how long Ubuntu and other Linux distributions will package a version of mod_wsgi that still supports Python 2, instead of just Python 3 (assuming that the Linux distribution even provides Python 2 at all).

Fedora 31 currently still provides a Python 2 sub-package of mod_wsgi, but this should be gone in Fedora 32 since it naturally depends on Python 2 and all such (sub-)packages are supposed to be purged. Debian's 'unstable' also currently seems to have the Python 2 version of mod_wsgi, but it's included in Debian's list of Python 2 related packages to be removed (via), so I suspect it will be gone from the next stable Debian release.

(Debian is also getting rid of Python 2 support for uwsgi, which could be another way of running our WSGI application under Apache.)

What Ubuntu 20.04 will look like is an interesting question. Right now, the in-progress state of Ubuntu 'focal' (what will be 20.04) includes a libapache2-mod-wsgi package using Python 2. However, this package is listed in Ubuntu's list of Python 2 related packages to remove (via). Ubuntu could still remove the package (along with others), or it could now be too close to the release of 20.04 for the removal to be carried through by then.

(I believe that Ubuntu usually freezes their package set a decent amount of time before the actual release in order to allow for testing, and perhaps especially for LTS releases. I may be wrong about this, because the Ubuntu Focal Fossa release schedule lists the Debian import freeze as quite late, at the end of February.)

Even if the Python 2 version of mod_wsgi manages to stay in Ubuntu 20.04 LTS (perhaps along with other Python 2 WSGI gateways), it will definitely be gone by the time of Ubuntu 22.04, which is when we'd normally upgrade the server that currently hosts our Django web app. So by 2022, we need to have some solution for our Python 2 problem with the app, whatever it is.


Comments on this page:

From 193.219.181.226 at 2020-01-20 00:43:44:

The third option is to pip install a Python 2 version of Gunicorn (the last Py2-compatible version was 19.10 but that's not too old yet). It's a (mostly) pure-Python WSGI gateway so it should keep working regardless of system libraries, and Apache will be able to use it as a generic proxy_http target.

By KC Marshall at 2020-01-21 12:00:44:

Would some kind of container technology (singularity, docker, ...) give you a way to keep running python2 based systems reliably? I don't think it is necessarily ideal from a security perspective, but it seems like a workable compromise.

From 188.33.16.128 at 2020-01-21 13:50:21:

Would some kind of container technology (singularity, docker, ...) give you a way to keep running python2 based systems reliably?

Dude, even chroot would allow that, no need for this fragile magic pixie dust of containers.

Written on 19 January 2020.
« Why a network connection becoming writable when it succeeds makes sense
The value of automation having ways to shut it off (a small story) »

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

Last modified: Sun Jan 19 22:17:05 2020
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.