This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Python installer needs elevated rights to install pip
Type: Stage:
Components: Windows Versions: Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: BreamoreBoy, larry, loewis, ncoghlan, ned.deily, poke, python-dev, terry.reedy
Priority: normal Keywords:

Created on 2014-02-16 21:31 by poke, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
pip.log poke, 2014-02-22 15:09 pip.log from the setup process
Messages (18)
msg211360 - (view) Author: Patrick Westerhoff (poke) Date: 2014-02-16 21:31
When installing Python 3.4 with the MSI, you can choose to install pip as part of the setup. With activated UAC on Windows (which is the recommended default), the installer will ask for elevated rights during the setup to copy the files over to the installation directory.

However, when the setup then attempts to install pip, the Python interpreter running the `ensurepip` library to install it is *not* run with elevated rights. This obviously results in a permission error when it then tries to copy over pip into the `\Scripts\` install directory.

This is similar to the advanced installer option “Compile .py files to byte code”, which has been failing forever because of the same problem. But now, with pip, this is an actual problem.

I suggest that you either run the pip install process from within the elevated setup, inheriting the rights—if that’s even possible—or explicitely request elevated rights for it again.
msg211370 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2014-02-16 23:00
Elevating to release blocker pending evaluation by Martin et al.
msg211819 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2014-02-21 07:49
I cannot reproduce the problem. It works fine for me.
msg211837 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2014-02-21 09:22
Patrick, could you let us know exactly which version of Windows exhibited the problem?

I also had no issues when testing the 3.4b3 installer on Windows 7 64-bit a few weeks ago, and I don't believe I have adjusted the UAC settings on that machine.
msg211838 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2014-02-21 09:33
Also, what kind of account exactly is attempting to perform the installation?
msg211880 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-02-21 22:24
I have default UAC on win7, 64 bit, installed from user account, gave admin password when requested, and did not see an error message (but have not tried to use pip either). 'pip' at command line is not recognized, but I don't know if it should be or if I have to be in the proper directory.

I did initially have a problem with c1, but that seems to be because .b3 did not properly uninstall .b2. (Once I re-downloaded .b2 so I could 'repair' .b2 and ininstall it from programs list, .c1 install worked.)
msg211888 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2014-02-21 23:07
Try pip3, Terry - there's an error in rc1 that means it doesn't install the
unversioned command (this is planned to be fixed in rc2).
msg211897 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-02-22 00:10
pip3 is not recognized either. There is a bunch of stuff added to 3.4 site_packages: easy_install, pip, pip1.5.2..., setuptools, setuptools2-1..., There is a py.exe but no pip.xxx in c:/windows.
msg211900 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-02-22 00:39
Surely tools like this would still be installed in c:\Python34\Scripts and not c:\Windows ?
msg211905 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2014-02-22 03:35
Mark: the installation of py.exe in c:\windows is correct, see PEP 397. Note that this is not at all the issue reported here.

Terry: Whether or not pip3 is found on the path is not the issue reported here, either. The OP mentioned "a permission error", although he didn't report how exactly this error manifests (I assume that the install process would fail, resulting in nothing being installed).
msg211919 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2014-02-22 10:49
I managed to reproduce the problem. It happens (for me) when installing into c:\program files (or \program files (x86)). I'll look into fixing it.
msg211924 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-02-22 13:50
FTR I was referring to Terry's comment that there's "no pip.xxx in c:/windows".  Pleased to see you have it sussed :)
msg211928 - (view) Author: Patrick Westerhoff (poke) Date: 2014-02-22 15:09
Hey all,

yes, I indeed try to install Python into `C:\Program Files\`. I’m doing that on Windows 8.1 64bit with an Administrator account (which doesn’t matter though) with standard UAC (which only asks when applications make changes to the computer settings). This UAC setting means that every access to e.g. `C:\Windows` or `C:\Program Files` will need elevated rights.

The MSI cannot be run with real administrator rights but automatically request elevated rights when they need it, so to install, I just execute it and let the installer request elevated rights as it needs to. My installation directory is `C:\Program Files\Development\Python34`.

Then, somewhere at the end of the setup bar, a Python console window pops up, saying that it’s installing pip. After its download, I can see some red text flash up and the window disappears (I’ve attached the `pip.log`). The installer then finishes, but the `\Scripts\` directory is missing.

As mentioned above, elevated rights are required when installing into `C:\Program Files\`. As you tried to reproduce it while installing to `C:\Python34\` you didn’t get the same problem. In fact, testing it again by installing it there works fine. This however is not really an acceptable solution for me. As suggested in my first message, the launched Python process should have elevated rights itself, but I don’t know if it’s possible to inherit those from the installer.

I don’t personally mind if this isn’t a blocker for the Python 3.4 release. I personally can live with installing pip with an elevated command line myself (that’s what I always did :P). But in the long run, we might want to find a real solution for this.
msg211937 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-02-22 18:37
I am installing into C:/Programs, so the problem is not specific to 'Program Files', with a space.
msg211968 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-02-22 22:44
New changeset 7b80f57f904e by Martin v. Löwis in branch 'default':
Issue #20641: Run custom actions with the NoImpersonate flag to support UAC.
http://hg.python.org/cpython/rev/7b80f57f904e
msg211971 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2014-02-22 22:47
This is now fixed; the cherry-picking request is issue20738.
msg211972 - (view) Author: Patrick Westerhoff (poke) Date: 2014-02-22 22:52
That’s great to hear, thanks a lot :)
msg213807 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-03-17 06:30
New changeset 31c7dc7ccbaa by Martin v. Löwis in branch '3.4':
Issue #20641: Run custom actions with the NoImpersonate flag to support UAC.
http://hg.python.org/cpython/rev/31c7dc7ccbaa
History
Date User Action Args
2022-04-11 14:57:58adminsetgithub: 64840
2014-03-17 06:30:50python-devsetmessages: + msg213807
2014-02-22 22:52:16pokesetmessages: + msg211972
2014-02-22 22:47:46loewissetstatus: open -> closed
resolution: fixed
messages: + msg211971
2014-02-22 22:44:48python-devsetnosy: + python-dev
messages: + msg211968
2014-02-22 18:37:50terry.reedysetmessages: + msg211937
2014-02-22 15:09:21pokesetfiles: + pip.log

messages: + msg211928
2014-02-22 13:50:27BreamoreBoysetmessages: + msg211924
2014-02-22 10:49:12loewissetmessages: + msg211919
2014-02-22 03:35:26loewissetmessages: + msg211905
2014-02-22 00:40:00BreamoreBoysetnosy: + BreamoreBoy
messages: + msg211900
2014-02-22 00:10:14terry.reedysetmessages: + msg211897
2014-02-21 23:07:56ncoghlansetmessages: + msg211888
2014-02-21 22:24:58terry.reedysetnosy: + terry.reedy
messages: + msg211880
2014-02-21 09:33:29loewissetpriority: release blocker -> normal

messages: + msg211838
2014-02-21 09:22:52ncoghlansetmessages: + msg211837
2014-02-21 07:49:34loewissetmessages: + msg211819
2014-02-16 23:00:19ned.deilysetpriority: normal -> release blocker
nosy: + loewis, ned.deily, ncoghlan, larry
messages: + msg211370

2014-02-16 21:31:14pokecreate