You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Windows installer for 2.7.13 doesn't install pip when installing to C:\Program Files #74910
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=Noneclosed_at=<Date2020-04-26.05:22:09.487>created_at=<Date2017-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=<Date2020-04-26.05:22:09.487>user='https://bugs.python.org/KevKeating'
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.
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.
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.
KevKeating commented on Jun 22, 2017
KevKeatingmannequin
MannequinAuthor
More actions
Here's the log file. I'm assuming that the relevant bit starts at around line 18663:
CAQuietExec: Collecting setuptoolsCAQuietExec: Collecting pipCAQuietExec: Installing collected packages: setuptools, pipCAQuietExec: 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 mainCAQuietExec: 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 runCAQuietExec: 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 installCAQuietExec: **kwargsCAQuietExec: 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 installCAQuietExec: 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_filesCAQuietExec: 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_filesCAQuietExec: 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 clobberCAQuietExec: shutil.copyfile(srcfile, destfile)CAQuietExec: File "C:\Program Files\Python27\lib\shutil.py", line 83, in copyfileCAQuietExec: with open(dst, 'wb') as fdst:CAQuietExec: IOError: Permission denied: 'C:\\Program Files\\Python27\\Lib\\site-packages\\easy_install.py'
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).
KevKeating commented on Jun 22, 2017
KevKeatingmannequin
MannequinAuthor
More actions
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".
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.
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.
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).
Activity
KevKeating commentedon Jun 21, 2017
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:
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.
zooba commentedon Jun 21, 2017
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.
KevKeating commentedon Jun 22, 2017
Here's the log file. I'm assuming that the relevant bit starts at around line 18663:
pfmoore commentedon Jun 22, 2017
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).
KevKeating commentedon Jun 22, 2017
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".
zooba commentedon Jun 22, 2017
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.
eryksun commentedon Jun 22, 2017
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.
pfmoore commentedon Jun 22, 2017
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).
eryksun commentedon Jun 22, 2017
You can still create and use virtual environments (virtualenv) without requiring administrator access.
KevKeating commentedon Jun 22, 2017
Running the msi from an elevated command prompt worked. Thanks!