Author uranusjr
Recipients dstufft, eric.araujo, frenzy, uranusjr, vstinner
Date 2021-08-07.14:29:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
On POSIX, the user scheme has a different 'platlib' location between distutils and sysconfig, dispite the comment claiming they should be the same.

This can be reproduced on Fedora 34's stock Python 3.9:

    $ docker run -it --rm -h=p fedora:34 bash
    [root@p /]# yum install python3 -y
    [root@p /]# type python3
    python3 is hashed (/usr/bin/python3)
    [root@p /]# python3 -V
    Python 3.9.6
    [root@p /]# python3.9 -q
    >>> from distutils.command.install import install
    >>> from distutils.dist import Distribution
    >>> c = install(Distribution())
    >>> c.user = True
    >>> c.finalize_options()
    >>> c.install_platlib
    >>> import sysconfig
    >>> sysconfig.get_path('platlib', 'posix_user')

This issue was introduced by the sys.platlibdir value, and its usage in distutils and sysconfig. sysconfig sets posix_user's lib paths like this:

    'purelib': '{userbase}/lib/python{py_version_short}/site-packages',
    'platlib': '{userbase}/{platlibdir}/python{py_version_short}/site-packages',

But distutils naively sets both to the same value that does not account for platlibdir:

    'purelib': '$usersite',
    'platlib': '$usersite',

causing the mismatch, dispite the comment above clearly indicating the values are supposed to be the same.

This was introduced in bpo-1294959 which changed the platlib template to depend on sys.platlibdir, so a mismatch happens when the value of sys.platlibdir is not 'lib'.

(Adding frenzy and vstinner to the nosy list since you introduced the comment in distutils and the sys.platlibdir change, respectively.)
Date User Action Args
2021-08-07 14:29:18uranusjrsetrecipients: + uranusjr, vstinner, eric.araujo, dstufft, frenzy
2021-08-07 14:29:18uranusjrsetmessageid: <>
2021-08-07 14:29:18uranusjrlinkissue44860 messages
2021-08-07 14:29:18uranusjrcreate