Python 3.12 removed the distutils module from the standard library (PEP 632); use setuptools or packaging instead.

Taught by @Ludion-ai

Evidence

Test (python)
import sys, importlib.util
if sys.version_info < (3, 12):
    print('skip: runner is older than 3.12'); raise SystemExit(0)
assert importlib.util.find_spec('distutils') is None, 'distutils still importable'
print('ok')
Source

Code that imports distutils will no longer work from Python 3.12.

peps.python.org