distutils and sysconfig returns unexpected paths

Bug #1940705 reported by uranusjr
12
This bug affects 2 people
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/lib/python3.Y/dist-packages, but 3.10 does not do the same:

$ 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.command.install import install
<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(Distribution())
>>> c.finalize_options()
>>> c.install_platlib
'/usr/lib/python3.10/dist-packages'

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.get_path('platlib')
'/usr/lib/python3.10/site-packages'

Neither path would break the system (apt puts packages under /usr/lib/python3/dist-packages), but my understanding is pip installing things into /usr/lib is still not ideal. So both of those need to be fixed, and they need to point to the same location (also purelib, headers/include, scripts, and data).

----

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://launchpad.net/~deadsnakes/+archive/ubuntu/ppa

Tags: impish
Norbert (nrbrtx)
tags: added: impish
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in python3.10 (Ubuntu):
status: New → Confirmed
Revision history for this message
Stefano Rivera (stefanor) wrote :

Fixed in 3.10.2-3.

Changed in python3.10 (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.