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

Upgrade to 20.2 fails on Windows Server 2019 #8644

Closed
pmeier opened this issue Jul 29, 2020 · 10 comments
Closed

Upgrade to 20.2 fails on Windows Server 2019 #8644

pmeier opened this issue Jul 29, 2020 · 10 comments

Comments

@pmeier
Copy link

pmeier commented Jul 29, 2020

Environment

  • pip version: 20.2
  • Python version: 3.[6-8]
  • OS: Windows Server 2019 via GitHubActions

Description

pip upgrade to 20.2 fails for Windows Server 2019. I've created a sample repository that runs pip install --upgrade with "pip==20.1.1" (old) and "pip==20.2" against all major platforms and Python 3.[6-8].

Note, that this is not a sudo issue, since the upgrade to the previous version runs fine.

Expected behavior

Upgrade without failures.

How to Reproduce

pip install --upgrade "pip==20.2"

Output

ERROR: Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\pip-uninstall-q3fbhmha\\pip.exe'
Consider using the `--user` option or check the permissions.
@triage-new-issues triage-new-issues bot added the S: needs triage Issues/PRs that need to be triaged label Jul 29, 2020
@uranusjr
Copy link
Member

Use python -m pip instead. (I thought we fixed this error message a while ago?)

@pfmoore
Copy link
Member

pfmoore commented Jul 29, 2020

Use python -m pip instead.

Or if you're not running in a virtualenv, use py -m pip. (Actually py -m pip works in a virtualenv too, so maybe use that regardless?)

@uranusjr
Copy link
Member

uranusjr commented Jul 29, 2020

I wonder if py.exe is available in the GitHub Actions’ Windows container (definitely use it if it is).

@pmeier
Copy link
Author

pmeier commented Jul 29, 2020

python -m pip does the trick. Is this a general recommendation when upgrading pip?

I wonder if py.exe is available in the GitHub Actions’ Windows container (definitely use it if it is).

I'd rather not, since this then requires different code for Windows.

@uranusjr
Copy link
Member

Yes, -m pip is the generally preferred way to run pip. There are even talks to deprecate the pip command entirely, but that’d be a very long term project.

@pmeier
Copy link
Author

pmeier commented Jul 29, 2020

@uranusjr Should I close this or do you want to keep it open?

@pradyunsg
Copy link
Member

(I thought we fixed this error message a while ago?)

Can someone with Windows test this, and check if the check in the logic for "modifying pip" is correct?

@pfmoore
Copy link
Member

pfmoore commented Jul 29, 2020

I'm not entirely sure what you want testing? The "pip is outdated" message correctly suggests python -m pip (using the full path to sys.executable). The Access Denied error, as quoted by the OP, isn't specific to upgrading pip and doesn't mention how to invoke pip at all.

@uranusjr
Copy link
Member

I believe there’s logic somewhere that tries to detect a user wants to do pip install -U pip and shows a different error message. That message should have been triggered here, but is not according to this report.

@uranusjr
Copy link
Member

Reading the implementation, the check (pip._internal.utils.misc.protect_pip_from_modification_on_windows) only guards against running through pip.exe (and the versioned variants), not pip without the extension. git blame led me to #7358, which removed the guard against the extension-less pip command since it mis-identifies python path\to\repo\src\pip as an error. The consensus seems to be that it is not worth the effort to improve the identification logic (my #7558 was closed unmerged), and pip should find a way to make this .exe replacement work, or deprecate the entry points altogether. So I’m closing this since the problem is tracked in #7567.

@pradyunsg pradyunsg added S: needs triage Issues/PRs that need to be triaged and removed S: needs triage Issues/PRs that need to be triaged labels Feb 12, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants