Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python installer needs elevated rights to install pip #64840

Closed
poke mannequin opened this issue Feb 16, 2014 · 18 comments
Closed

Python installer needs elevated rights to install pip #64840

poke mannequin opened this issue Feb 16, 2014 · 18 comments

Comments

@poke
Copy link
Mannequin

poke mannequin commented Feb 16, 2014

BPO 20641
Nosy @loewis, @terryjreedy, @ncoghlan, @larryhastings, @ned-deily
Files
  • pip.log: pip.log from the setup process
  • 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 2014-02-22.22:47:46.000>
    created_at = <Date 2014-02-16.21:31:14.888>
    labels = ['OS-windows']
    title = 'Python installer needs elevated rights to install pip'
    updated_at = <Date 2014-03-17.06:30:50.938>
    user = 'https://bugs.python.org/poke'

    bugs.python.org fields:

    activity = <Date 2014-03-17.06:30:50.938>
    actor = 'python-dev'
    assignee = 'none'
    closed = True
    closed_date = <Date 2014-02-22.22:47:46.000>
    closer = 'loewis'
    components = ['Windows']
    creation = <Date 2014-02-16.21:31:14.888>
    creator = 'poke'
    dependencies = []
    files = ['34184']
    hgrepos = []
    issue_num = 20641
    keywords = []
    message_count = 18.0
    messages = ['211360', '211370', '211819', '211837', '211838', '211880', '211888', '211897', '211900', '211905', '211919', '211924', '211928', '211937', '211968', '211971', '211972', '213807']
    nosy_count = 8.0
    nosy_names = ['loewis', 'terry.reedy', 'ncoghlan', 'larry', 'ned.deily', 'poke', 'BreamoreBoy', 'python-dev']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue20641'
    versions = ['Python 3.4']

    @poke
    Copy link
    Mannequin Author

    poke mannequin commented Feb 16, 2014

    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.

    @poke poke mannequin added the OS-windows label Feb 16, 2014
    @ned-deily
    Copy link
    Member

    Elevating to release blocker pending evaluation by Martin et al.

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Feb 21, 2014

    I cannot reproduce the problem. It works fine for me.

    @ncoghlan
    Copy link
    Contributor

    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.

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Feb 21, 2014

    Also, what kind of account exactly is attempting to perform the installation?

    @loewis loewis mannequin removed the release-blocker label Feb 21, 2014
    @terryjreedy
    Copy link
    Member

    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.)

    @ncoghlan
    Copy link
    Contributor

    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).

    @terryjreedy
    Copy link
    Member

    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.

    @BreamoreBoy
    Copy link
    Mannequin

    BreamoreBoy mannequin commented Feb 22, 2014

    Surely tools like this would still be installed in c:\Python34\Scripts and not c:\Windows ?

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Feb 22, 2014

    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).

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Feb 22, 2014

    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.

    @BreamoreBoy
    Copy link
    Mannequin

    BreamoreBoy mannequin commented Feb 22, 2014

    FTR I was referring to Terry's comment that there's "no pip.xxx in c:/windows". Pleased to see you have it sussed :)

    @poke
    Copy link
    Mannequin Author

    poke mannequin commented Feb 22, 2014

    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.

    @terryjreedy
    Copy link
    Member

    I am installing into C:/Programs, so the problem is not specific to 'Program Files', with a space.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Feb 22, 2014

    New changeset 7b80f57f904e by Martin v. Löwis in branch 'default':
    Issue bpo-20641: Run custom actions with the NoImpersonate flag to support UAC.
    http://hg.python.org/cpython/rev/7b80f57f904e

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Feb 22, 2014

    This is now fixed; the cherry-picking request is bpo-20738.

    @loewis loewis mannequin closed this as completed Feb 22, 2014
    @poke
    Copy link
    Mannequin Author

    poke mannequin commented Feb 22, 2014

    That’s great to hear, thanks a lot :)

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Mar 17, 2014

    New changeset 31c7dc7ccbaa by Martin v. Löwis in branch '3.4':
    Issue bpo-20641: Run custom actions with the NoImpersonate flag to support UAC.
    http://hg.python.org/cpython/rev/31c7dc7ccbaa

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants