Skip to content

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

Description

@xdegaye
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

    1. xdegaye commented on Jul 26, 2017

      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.

    2. added
      buildThe build process and cross-build
      type-bugAn unexpected behavior, bug, or error
      on Jul 26, 2017
    3. 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

    4. mcepl commented on Nov 30, 2018

      mceplmannequin
      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?

    5. transferred this issue fromon Apr 10, 2022
    6. added a commit that references this issue on Oct 13, 2023
    7. added
      stdlibStandard Library Python modules in the Lib/ directory
      on Jun 13, 2025
    8. added 5 commits that reference this issue on Apr 29, 2026
    9. added 2 commits that reference this issue on Sep 4, 2026
    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-buildstdlibStandard Library Python modules in the Lib/ directorytopic-ensurepiptype-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions