Skip to content

Fix the install scheme to posix_prefix when --prefix is passed #10978

@frostming

Description

@frostming

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    project: <downstream>When the cause/effect is related to redistributorstype: bugA confirmed bug or unintended behavior

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions