Fix the install scheme to `posix_prefix` when `--prefix` is passed
See original GitHub issueWhat’s the problem this feature will solve?
On Debian systems, due to the sysconfig patch, sysconfig.get_preferred_scheme('prefix')
will return posix_local
, which is also the default scheme. This causes problem when using --prefix <path>
with pip install
, where packages are installed to <prefix_path>/local/lib/pythonX.Y/dist-packages
. This is apparently wrong.
Describe the solution you’d like
Add a special case to pip._internal.locations._sysconfig:get_scheme()
, when posix_local
is found in INSTALL_SCHEMES
and prefix
is not None, rewrite the scheme as posix_prefix
.
Alternative Solutions
I am not sure if it is better to report it to Debian, but IMO it makes more sense to fix it in pip
to be more robust.
Additional context
- https://salsa.debian.org/cpython-team/python3/-/blob/master/debian/patches/sysconfig-debian-schemes.diff
- https://github.com/deadsnakes/issues/issues/182
Code of Conduct
- I agree to follow the PSF Code of Conduct.
Issue Analytics
- State:
- Created a year ago
- Comments:11 (7 by maintainers)
Top Results From Across the Web
Linux distro patches to `sysconfig` are changing `pip install
Normally, when you do a pip install --prefix /tmp/foo sampleproject, ... Fix the install scheme to `posix_prefix` when `--prefix` is passed.
Read more >libarchive/archive_read_support_format_tar.c - third_party/ ...
Old GNU format doesn't use POSIX 'prefix' field; they use ... "tar: hdrcharset option needs a character-set name"); ... Setup default string conversion....
Read more >mail-crypt-plugin
Default is mail_crypt_global . Example: plugin { fts_index_fs = crypt:set_prefix=fscrypt_index:posix:prefix=/tmp/fts fscrypt_index_public_key = < ...
Read more >FlatFS: Flatten Hierarchical File System Namespace on ...
passes the VFS directory tree and directly manipulates dentry ... current POSIX prefix permission checking specification is.
Read more >No Title - LIGO-Labcit Home - Caltech
build-e2e -install -prefix=/home/myUserName/e2e. After the installation is ... To set this variable for bourne shell and its derivitives use ``E2E_PATH=.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hmm yeah at least they should match. I don’t think Debian can handle this though; the
--prefix
value is not passed to sysconfig so they have no way to magically choose a scheme based on it. We’ll likely need to somehow handle this in pip, or raise an issue to CPython to further enhance the sysconfig API.FWIW, Fedora also has a similarly breaking patch (https://github.com/fedora-python/cpython/blob/f52f499bb9ac03d7793fa2e1ccaaab8a3169685e/Lib/sysconfig.py#L77) and they directly modify
posix_prefix
.I suggest we move further discussion to https://discuss.python.org/t/18240, mostly because that’s a better forum for the sort of cross-project discussion that this is gonna need.