-
Notifications
You must be signed in to change notification settings - Fork 3k
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
pip uninstall failing on Windows 10 #8274
Comments
Hi! IMHO this should be done for all packages, i.e. if install will fail then after uninstall we should have something to revert to. For the permission case only GH-6762 might fix it. |
Note that not all of pip's developers have access to the all OSes, so the output of the steps, are especially relevant and helpful. :) |
Also,
The recommended way of updating pip on Windows is This may or may not be relevant to the issue you're reporting, but it would be helpful if you could update your description of how to reproduce the issue so that it uses the supported approach. |
OK, I just did it again on the newly updated windows 10 (10.0.19041) with python-3.8.2-amd64.exe. Here's what happened after the installation from powershell.
so I opened another powershell window with admin privilege.
OK...the update worked although there were some errors, and I'm not sure which step I did different from the last one. I'll try to reproduce the issue again on my other laptop at office next week. Thank you all again. |
At this point maybe we should just add a check in |
Uhm... I think I see the issue here: pip/src/pip/_internal/commands/install.py Line 340 in cbdf5b1
The conditional here is wrong. :) |
Just had another try. Python:python-3.8.3-amd64.exe(downloaded from python.org)
PS C:\Users\Leo Wang> pip install pip -U
Pheeeeew! This is exactly what I was trying to let you guys when opening this issue. @pfmoore, the reason why I'm using this very "pip install pip -U" is that I was trying to update the pip source with a mainland mirror in China, so I referred to the tuna page (https://mirrors.tuna.tsinghua.edu.cn/help/pypi/) which is owned and maintained by Tsinghua University. And it says to change the default mirror to tuna, the right way is to do these: Anyway, please see if there's anything that can be bettered to avoid future users from stepping into this situation. Thank you all. |
A much better approach would be to download and run https://bootstrap.pypa.io/get-pip.py. @Awful-Leo As @pfmoore noted, on Windows, you should do |
So is the conditional flipped and should be |
I don't know if it's directly related, but a student of mine encontered something like this, but in a venv:
"Accès refusé" mean "Access denied", but as it's in a freshly created venv, the pip.exe was freshly created with the same user and same session, and also freshly deleted by the uninstall, so it's probably not exactly an acess right error. |
@JulienPalard On Windows, the OS locks a running executable so it can't be modified or deleted. So The fix is, as per the recommendation in the documentation, to use the longer form The discussion here is mostly about whether we can improve the error to explain what's happened better. It's annoyingly difficult to do so 🙁 |
Thanks @pfmoore for this clear clarification! IIRC, after trying the The student had hard time figuring this out, as "the pip command" would continue working after the deletion of Enhancing the message would be a good start, but if it still delete |
The pip.exe shouldn't be getting deleted, unless Windows has started doing something new. |
Not entirely on topic, but I would suggest recommending newcomers to avoid |
Environment
Description
Expected behavior
When uninstalling pip, temporarily stores the old pip to a temp folder maybe. If the installing of the newer version is successful, delete the temp file; if not, roll back and reinstall the original version.
How to Reproduce
Follow the above.
The text was updated successfully, but these errors were encountered: