Skip to content

Windows installer for 2.7.13 doesn't install pip when installing to C:\Program Files #74910

Closed

Description

@KevKeating
BPO 30725
Nosy @pfmoore, @tjguk, @zware, @eryksun, @zooba
Files
  • log.txt
  • 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 = <Date 2020-04-26.05:22:09.487>
    created_at = <Date 2017-06-21.17:59:07.809>
    labels = ['expert-installation', 'OS-windows']
    title = "Windows installer for 2.7.13 doesn't install pip when installing to C:\\Program Files"
    updated_at = <Date 2020-04-26.05:22:09.487>
    user = 'https://bugs.python.org/KevKeating'

    bugs.python.org fields:

    activity = <Date 2020-04-26.05:22:09.487>
    actor = 'zach.ware'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-04-26.05:22:09.487>
    closer = 'zach.ware'
    components = ['Installation', 'Windows']
    creation = <Date 2017-06-21.17:59:07.809>
    creator = 'KevKeating'
    dependencies = []
    files = ['46969']
    hgrepos = []
    issue_num = 30725
    keywords = []
    message_count = 10.0
    messages = ['296571', '296575', '296631', '296632', '296634', '296636', '296638', '296640', '296642', '296643']
    nosy_count = 6.0
    nosy_names = ['paul.moore', 'tim.golden', 'zach.ware', 'eryksun', 'steve.dower', 'KevKeating']
    pr_nums = []
    priority = 'normal'
    resolution = 'out of date'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue30725'
    versions = ['Python 2.7']

    Activity

    1. KevKeating commented on Jun 21, 2017

      KevKeatingmannequin
      MannequinAuthor

      If I use the Python 64-bit 2.7.13 Windows installer and install to C:\Program Files\Python27, then the Scripts folder doesn't get created and pip doesn't get installed. If I uninstall Python and reinstall it to C:\Python27, C:\Programs\Python27, or "C:\Path with spaces\Python27", then the Scripts folder is created and pip works correctly. If I install Python 2.7.12 using https://www.python.org/ftp/python/2.7.12/python-2.7.12.amd64.msi or Python 3.6.1 using https://www.python.org/ftp/python/3.6.1/python-3.6.1-amd64.exe, then I don't experience this issue. This issue does happen if I install to C:\PROGRA~1\Python27, which is the 8.3 filename equivalent of C:\Program Files\Python27. I've seen this on a handful of Windows 10 computers so far. I haven't tried other versions of Windows or the 32-bit installers.

      Steps to reproduce:

      • Download the Python installer from https://www.python.org/ftp/python/2.7.13/python-2.7.13.amd64.msi and run it.
      • Select "Install for all users" and click Next.
      • Enter C:\Program Files\Python27 as the installation folder and click Next.
      • Click on "Register Extensions" and select "Entire feature will be unavailable". (I don't know if this step is required, but it's what I've been doing to test.) Click Next.
      • Click Yes at the UAC prompt.
      • Wait for installation to finish.

      Expected results:
      The "C:\Program Files\Python27\Scripts" and "C:\Program Files\Python27\Lib\site-packages\pip" folders should get created during the installation.

      Actual results:
      Neither of the folders exist.

    2. zooba commented on Jun 21, 2017

      @zooba
      Member

      I wonder if the custom action to run _ensurepip isn't running as admin... that would be the only thing I can think of.

      Can you try running the installer with:

      msiexec /l*vx log.txt /i path_to.msi

      Then attach the generated log.txt file? We might be able to see what's happening better with that.

    3. KevKeating commented on Jun 22, 2017

      KevKeatingmannequin
      MannequinAuthor

      Here's the log file. I'm assuming that the relevant bit starts at around line 18663:

      CAQuietExec:  Collecting setuptools
      CAQuietExec:  Collecting pip
      CAQuietExec:  Installing collected packages: setuptools, pip
      CAQuietExec:  Exception:
      CAQuietExec:  Traceback (most recent call last):
      CAQuietExec:    File "c:\users\keating\appdata\local\temp\tmpcvofqv\pip-9.0.1-py2.py3-none-any.whl\pip\basecommand.py", line 215, in main
      CAQuietExec:      status = self.run(options, args)
      CAQuietExec:    File "c:\users\keating\appdata\local\temp\tmpcvofqv\pip-9.0.1-py2.py3-none-any.whl\pip\commands\install.py", line 342, in run
      CAQuietExec:      prefix=options.prefix_path,
      CAQuietExec:    File "c:\users\keating\appdata\local\temp\tmpcvofqv\pip-9.0.1-py2.py3-none-any.whl\pip\req\req_set.py", line 784, in install
      CAQuietExec:      **kwargs
      CAQuietExec:    File "c:\users\keating\appdata\local\temp\tmpcvofqv\pip-9.0.1-py2.py3-none-any.whl\pip\req\req_install.py", line 851, in install
      CAQuietExec:      self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
      CAQuietExec:    File "c:\users\keating\appdata\local\temp\tmpcvofqv\pip-9.0.1-py2.py3-none-any.whl\pip\req\req_install.py", line 1064, in move_wheel_files
      CAQuietExec:      isolated=self.isolated,
      CAQuietExec:    File "c:\users\keating\appdata\local\temp\tmpcvofqv\pip-9.0.1-py2.py3-none-any.whl\pip\wheel.py", line 345, in move_wheel_files
      CAQuietExec:      clobber(source, lib_dir, True)
      CAQuietExec:    File "c:\users\keating\appdata\local\temp\tmpcvofqv\pip-9.0.1-py2.py3-none-any.whl\pip\wheel.py", line 323, in clobber
      CAQuietExec:      shutil.copyfile(srcfile, destfile)
      CAQuietExec:    File "C:\Program Files\Python27\lib\shutil.py", line 83, in copyfile
      CAQuietExec:      with open(dst, 'wb') as fdst:
      CAQuietExec:  IOError:  Permission denied: 'C:\\Program Files\\Python27\\Lib\\site-packages\\easy_install.py'
    4. pfmoore commented on Jun 22, 2017

      @pfmoore
      Member

      Presumably you overrode the default location of C:\Python27 in favour
      of C:\Program Files?

      I'm not sure we've ever supported installing Python 2.7 in "Program
      Files", precisely because of the security constraints on that
      directory (plus the fact that a long time ago, directories with spaces
      in them were badly handled, but that problem should no longer exist).

    5. KevKeating commented on Jun 22, 2017

      KevKeatingmannequin
      MannequinAuthor

      Yeah, I only run into this problem if I install Python 2.7.13 into C:\Program Files\Python27. If I install Python 2.7.12 or 3.6.1 to the same location, then everything works fine. I can successfully install Python 2.7.13 to C:\Python27, C:\Programs\Python27, or "C:\Path with spaces\Python27".

    6. zooba commented on Jun 22, 2017

      @zooba
      Member

      The relevant lines are just above the ones you posted, but I can't view the attachment from my phone so I'll have to look later.

      Seems like the custom action is running as the original user and not admin. This should just be a flag on the command, though since we're building the msi without any tools it'll take some effort to figure that out.

      Personally I'd rather say it's not supported. Install without pip and then add it later. But if someone comes with a patch and test results I'll happily merge it.

    7. eryksun commented on Jun 22, 2017

      @eryksun
      Contributor

      bpo-27888 switched to using WiX CAQuietExec task to hide the console, but it also changed the action flags to no longer include msidbCustomActionTypeNoImpersonate (2048). Without this flag, the installer impersonates the user for these custom actions: UpdatePip, RemovePip, CompilePyc, CompilePyo, CompileGrammar.

      As a workaround, run the .msi from an elevated command prompt. In this case, I also recommend enabling the option to pre-compile the standard library.

    8. pfmoore commented on Jun 22, 2017

      @pfmoore
      Member

      Note that even if you do get this working, you'll still need to run
      pip from an elevated prompt every time you want to use it to install
      new packages (or use --user).

    9. eryksun commented on Jun 22, 2017

      @eryksun
      Contributor

      You can still create and use virtual environments (virtualenv) without requiring administrator access.

    10. KevKeating commented on Jun 22, 2017

      KevKeatingmannequin
      MannequinAuthor

      Running the msi from an elevated command prompt worked. Thanks!

    11. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions