Skip to content

ensurepip does not honour the value of $(prefix) #75229

@xdegaye

Description

@xdegaye
mannequin
Mannequin
BPO 31046
Nosy @ncoghlan, @mcepl, @vadmium, @dstufft, @moreati, @ZackerySpytz
PRs
  • gh-75229: ensurepip does not honour the value of $(prefix) #17634
  • WIP: bpo-31046: ensurepip should honour the value of $(prefix) #19068
  • Files
  • ensurepip_prefix.diff
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2017-07-26.16:39:28.627>
    labels = ['type-bug', '3.9', 'build']
    title = 'ensurepip does not honour the value of $(prefix)'
    updated_at = <Date 2020-03-19.10:08:27.658>
    user = 'https://github.com/xdegaye'

    bugs.python.org fields:

    activity = <Date 2020-03-19.10:08:27.658>
    actor = 'mcepl'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Cross-Build']
    creation = <Date 2017-07-26.16:39:28.627>
    creator = 'xdegaye'
    dependencies = []
    files = ['47041']
    hgrepos = []
    issue_num = 31046
    keywords = ['patch']
    message_count = 3.0
    messages = ['299252', '299290', '330805']
    nosy_count = 6.0
    nosy_names = ['ncoghlan', 'mcepl', 'martin.panter', 'dstufft', 'Alex.Willmer', 'ZackerySpytz']
    pr_nums = ['17634', '19068']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue31046'
    versions = ['Python 3.9']

    Linked PRs

    Activity

    xdegaye

    xdegaye commented on Jul 26, 2017

    @xdegaye
    xdegayemannequin
    MannequinAuthor

    When cross-compiling, the local Python interpreter that is used to run ensurepip may not have the same value of sys.prefix as the value of the 'prefix' variable that is set in the Makefile.

    With the following values used to install Python locally for a later copy to the files hierarchy owned by the 'termux' application on an Android device:

    DESTDIR=/tmp/android
    prefix=/data/data/com.termux/files/usr/local
    

    'make install' causes ensurepip to install pip in $(DESTDIR)/usr/local instead of the expected $(DESTDIR)/$(prefix) where is installed the standard library.

    The attached patch fixes the problem. The patch was implemented assuming that pip uses distutils for the installation (note that setup.py also uses the --prefix option in the Makefile), but I know nothing about pip so forgive me if the patch is wrong and please just assume it is just a way to demonstrate the problem.

    added
    buildThe build process and cross-build
    type-bugAn unexpected behavior, bug, or error
    on Jul 26, 2017
    ncoghlan

    ncoghlan commented on Jul 27, 2017

    @ncoghlan
    Contributor

    This looks like the right technical fix to me (see https://pip.pypa.io/en/stable/reference/pip_install/#cmdoption-prefix), but I'd like Donald to confirm that before we merge anything.

    Making this change will also require an update to the ensurepip docs: https://docs.python.org/3/library/ensurepip.html#command-line-interface

    mcepl

    mcepl commented on Nov 30, 2018

    @mcepl
    Mannequin

    Per https://devguide.python.org/pullrequest/, can I ask you Xavier to prepare a proper pull request for this patch to the GitHub repo, please?

    added
    3.9only security fixes
    and removed on Dec 17, 2019
    transferred this issue fromon Apr 10, 2022
    added a commit that references this issue on Oct 13, 2023

    pythongh-75229: Add support for setting prefix in ensurepip

    2fb4e2e
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      buildThe build process and cross-buildstdlibPython modules in the Lib dirtopic-ensurepiptype-bugAn unexpected behavior, bug, or error

      Projects

      No projects

      Milestone

      No milestone

      Relationships

      None yet

        Development

        Participants

        @ncoghlan@pradyunsg@picnixz@erlend-aasland

        Issue actions

          ensurepip does not honour the value of $(prefix) · Issue #75229 · python/cpython