This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Allow overriding sys.platlibdir: add PYTHONPLATLIBDIR env var
Type: Stage: resolved
Components: Interpreter Core Versions: Python 3.10
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: python-dev, smani, vstinner
Priority: normal Keywords: patch

Created on 2020-06-03 11:00 by smani, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 20605 merged python-dev, 2020-06-03 11:00
PR 20725 merged vstinner, 2020-06-08 16:31
PR 20735 merged vstinner, 2020-06-08 17:39
PR 20799 closed smani, 2020-06-11 10:07
PR 20807 merged vstinner, 2020-06-11 14:08
PR 20813 merged vstinner, 2020-06-11 15:49
Messages (13)
msg370655 - (view) Author: Sandro Mani (smani) * Date: 2020-06-03 11:00
You can currently point the python interpreter to a different install say via

    export PYTHONHOME=<Prefix>
    export PYTHONPATH=<Prefix>/lib/python3.9
    python3

With the newly added platlibdir [1], if python was configured with platlibdir=lib64, this will break because i.e. the site-packages dir as returned by `sysconfig.get_paths()` will use lib64 and not lib as the other install may be using.

This PR adds the possibility to override the platlibdir via environment variable.

Full rationale: [2].

[1] https://github.com/python/cpython/pull/8068
[2] https://src.fedoraproject.org/rpms/python3.9/pull-request/10
msg370773 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-06-05 17:39
Fedora and OpenSUSE Linux distributions were using a downstream patch which replaced /lib/ with /lib64/ for like 15 years.

Is this issue a new issue? Or did Fedora always had the issue for example?

Which Linux distribution are you using?
msg370800 - (view) Author: Sandro Mani (smani) * Date: 2020-06-06 00:12
I'm on Fedora. My use case is for the mingw-python package I maintain there, see [1] for the full details. I believe (though I haven't investigated) that the previous downstream lib64 patch behaved slightly differently, or that something else between python-3.8 and earlier and python-3.9 changed, in that I didn't have lib64 appear in the site packages path previously when invoking python as detailed in [1], whereas it now does.

[1] https://src.fedoraproject.org/rpms/python3.9/pull-request/10#comment-0
msg370993 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-06-08 15:28
New changeset 8f023a2f664f902a3d0b7a6f64d63afc0d1c15ae by Sandro Mani in branch 'master':
bpo-40854: Allow overriding sys.platlibdir via PYTHONPLATLIBDIR env-var (GH-20605)
https://github.com/python/cpython/commit/8f023a2f664f902a3d0b7a6f64d63afc0d1c15ae
msg370994 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-06-08 15:29
I merged the patch in master, future Python 3.10. I would prefer to leave Python 3.9 unchanged, if possible. Can we close this issue?
msg370997 - (view) Author: Sandro Mani (smani) * Date: 2020-06-08 15:36
Many thanks! - I'll ask downstream to carry the patch for the 3.9 cycle, so I'm ok with closing.
msg371007 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-06-08 16:33
bpo-1294959 added sys.platlibdir and configure --with-platlibdir to use /usr/lib64 on Fedora and SuSE to Python 3.9.

The problem is that msg370655 use case seems to be a regression compared to Python 3.9. I now consider to backport the commit 8f023a2f664f902a3d0b7a6f64d63afc0d1c15ae to 3.9 since it looks like a fix part of bpo-1294959 rather than a bug fix.

I created PR 20725 to backport PyConfig.platlibdir and PYTHONPLATLIBDIR env var to Python 3.9.
msg371032 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-06-08 17:36
New changeset 817506432dd1908cd154500ef18dc276b8dd7071 by Victor Stinner in branch '3.9':
bpo-40854: Allow overriding sys.platlibdir via PYTHONPLATLIBDIR env-var (GH-20605) (GH-20725)
https://github.com/python/cpython/commit/817506432dd1908cd154500ef18dc276b8dd7071
msg371033 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-06-08 18:04
New changeset 5edb83241f2ff899917e895092aca0216faf42d3 by Victor Stinner in branch 'master':
bpo-40854: PYTHONPLATLIBDIR env var added to 3.9 (GH-20735)
https://github.com/python/cpython/commit/5edb83241f2ff899917e895092aca0216faf42d3
msg371128 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-06-09 16:53
Thanks Sandro Mani. The new env var should be part of the incoming Python 3.9.0 beta3.
msg371285 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-06-11 14:11
Follow-up: bpo-40947 "Replace PLATLIBDIR macro with config->platlibdir".
msg371293 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-06-11 15:29
New changeset d72b9644a3e6eec83be48b1ebc2ec6ca776134d3 by Victor Stinner in branch 'master':
bpo-40947: getpath.c uses PyConfig.platlibdir (GH-20807)
https://github.com/python/cpython/commit/d72b9644a3e6eec83be48b1ebc2ec6ca776134d3
msg371304 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-06-11 16:27
New changeset dc40105c88b968a50c3458e10e1d732e957ef0a3 by Victor Stinner in branch '3.9':
bpo-40947: getpath.c uses PyConfig.platlibdir (GH-20807) (GH-20813)
https://github.com/python/cpython/commit/dc40105c88b968a50c3458e10e1d732e957ef0a3
History
Date User Action Args
2022-04-11 14:59:31adminsetgithub: 85031
2020-06-11 16:27:04vstinnersetmessages: + msg371304
2020-06-11 15:49:33vstinnersetpull_requests: + pull_request20011
2020-06-11 15:29:01vstinnersetmessages: + msg371293
2020-06-11 14:11:15vstinnersetmessages: + msg371285
2020-06-11 14:08:33vstinnersetpull_requests: + pull_request20004
2020-06-11 10:07:02smanisetpull_requests: + pull_request19995
2020-06-09 16:53:22vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg371128

stage: patch review -> resolved
2020-06-08 18:04:51vstinnersetmessages: + msg371033
2020-06-08 17:39:23vstinnersetpull_requests: + pull_request19942
2020-06-08 17:36:19vstinnersetmessages: + msg371032
2020-06-08 16:37:25vstinnersettitle: [Patch] Allow overriding sys.platlibdir: add PYTHONPLATLIBDIR env var -> Allow overriding sys.platlibdir: add PYTHONPLATLIBDIR env var
2020-06-08 16:34:05vstinnersettitle: [Patch] Allow overriding sys.platlibdir -> [Patch] Allow overriding sys.platlibdir: add PYTHONPLATLIBDIR env var
2020-06-08 16:33:58vstinnersetmessages: + msg371007
2020-06-08 16:31:20vstinnersetpull_requests: + pull_request19935
2020-06-08 15:36:14smanisetmessages: + msg370997
2020-06-08 15:29:47vstinnersetmessages: + msg370994
2020-06-08 15:28:20vstinnersetmessages: + msg370993
2020-06-06 00:12:11smanisetmessages: + msg370800
2020-06-05 17:39:47vstinnersetnosy: + vstinner
messages: + msg370773
2020-06-03 11:00:36python-devsetkeywords: + patch
nosy: + python-dev

pull_requests: + pull_request19832
stage: patch review
2020-06-03 11:00:25smanicreate