distutils and sysconfig returns unexpected paths
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
python3.10 (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Debian and Ubuntu’s Python 3.9 (and prior) patches distutils so pip installs things to /usr/local/
$ python3.10
Python 3.10.0b1 (default, May 11 2021, 08:45:09) [GCC 10.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from distutils.
<stdin>:1: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
>>> from distutils.dist import Distribution
>>> c = install(
>>> c.finalize_
>>> c.install_platlib
'/usr/lib/
Furthermore, pip is planning to switch to sysconfig for fetching the path soon (could happen before Ubuntu 21.10), and 3.10’s sysconfig is currently returning a different, but still unexpected path:
>>> import sysconfig
>>> sysconfig.
'/usr/lib/
Neither path would break the system (apt puts packages under /usr/lib/
----
Some context to this: The python3.10 package is backported to earlier Ubuntu versions by deadsnakes, which does not ship python3.10-pip, so people are installing the upstream pip directly. And when they do this, /usr/bin/pip gets overwritten unexpectedly.
deadsnakes: https:/
Status changed to 'Confirmed' because the bug affects multiple users.