question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fix the install scheme to `posix_prefix` when `--prefix` is passed

See original GitHub issue

What’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

Code of Conduct

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
uranusjrcommented, Mar 22, 2022

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.

1reaction
pradyunsgcommented, Aug 15, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found