Comment 2 for bug 2061929

Revision history for this message
A. Karl Kornel (akkornel) wrote : Re: Python docker page does not import: No module named 'distutils'

I've been doing some checking, and it looks like this is because Python 3.12 (the default python3) no longer includes distutils. See https://docs.python.org/3.12/whatsnew/3.12.html (the first paragraph under the heading "Summary – Release highlights"), as well as PEP-0632 (https://peps.python.org/pep-0632/).

I figured this out when I tried downgrading the package to the version in Mantic (5.0.3-1ubuntu1): `dpkg` complained that it depends on `python3-distutils`. That led me to searching for the package in Noble, and getting to this point.

(Adding the `regression-release` tag. Apologies if this is the wrong regression tag to apply!)

BTW, this isn't affecting Debian 12 because they're using Python 3.11, the last Python version to include distutils in the standard library. Debian sid is currently on Python 3.11.8, so they haven't hit this issue yet.

As for upstream, looking at PyPi (https://pypi.org/project/docker/#history), 5.0.3 was the last of the 5.x series. Their latest versions are 6.1.3 and 7.0.0. Their changelog page (https://docker-py.readthedocs.io/en/stable/change-log.html) does not explicitly say when they moved away from distutils, but from Git commits it looks like the removal happened in https://github.com/docker/docker-py/commit/42789818bed5d86b487a030e2e60b02bf0cfa284, which was included in the 6.0.0 and later releases.

So, what to do in the meantime? According to PEP-0632, Setuptools adopted distutils, and this started to happen in Setuptools 48 (https://github.com/pypa/setuptools/issues/417#issuecomment-653593796). Since the python3-setuptools package in Noble is newer (68.1.2-2ubuntu1), probably the best workaround is for `python3-docker` to depend on `python3-setuptools`.

== Regression details ==
Discovered in version:5.0.3-1ubuntu1
Last known good version:5.0.3-1