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

Although pip has successfully upgraded itself, an error is still prompted in cmd. #10973

Closed
1 task done
Delhpi opened this issue Mar 18, 2022 · 7 comments
Closed
1 task done
Labels
resolution: not a bug Determined as not a bug in pip

Comments

@Delhpi
Copy link

Delhpi commented Mar 18, 2022

Description

Although pip has successfully upgraded itself, an error is still prompted in cmd. This error should not show up。
http://www.gotopjs.top/download/pip3.jpg

Expected behavior

should show that the installation was successful

pip version

22.0.4

Python version

3.10.3

OS

windows 10

How to Reproduce

(myenv) C:\myenv\Scripts>pip install -U --force-reinstall pip

Output

(myenv) C:\myenv\Scripts>pip install -U pip
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Requirement already satisfied: pip in c:\myenv\lib\site-packages (22.0.4)

(myenv) C:\myenv\Scripts>pip install -U --force-reinstall pip
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting pip
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/4d/16/0a14ca596f30316efd412a60bdfac02a7259bf8673d4d917dc60b9a21812/pip-22.0.4-py3-none-any.whl (2.1 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 22.0.4
    Uninstalling pip-22.0.4:
      Successfully uninstalled pip-22.0.4
ERROR: Could not install packages due to an OSError: [WinError 5] 拒绝访问。: 'C:\\Users\\Win10\\AppData\\Local\\Temp\\pip-uninstall-cpk_2rzc\\pip.exe'
Check the permissions.


(myenv) C:\myenv\Scripts>

Code of Conduct

@Delhpi Delhpi added S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior labels Mar 18, 2022
@pfmoore pfmoore added resolution: not a bug Determined as not a bug in pip and removed type: bug A confirmed bug or unintended behavior S: needs triage Issues/PRs that need to be triaged labels Mar 18, 2022
@pfmoore
Copy link
Member

pfmoore commented Mar 18, 2022

This is a known problem when you use the pip.exe command to upgrade pip, because Windows is unable to replace a running executable. It's not practical to remove the error, which is why the documented way of upgrading pip is to use py -m pip install -U pip, not using the pip command directly.

@pfmoore pfmoore closed this as completed Mar 18, 2022
@pradyunsg
Copy link
Member

Please use py -m pip or python -m pip to upgrade pip. This issue will be fixed in the next pip release, but you'll only see this upgrading from 22.1 to a newer version. L

@pfmoore
Copy link
Member

pfmoore commented Mar 18, 2022

@pradyunsg Did I miss a fix for this getting applied? Do you have a link?

@uranusjr
Copy link
Member

I think it’s #10560? Not yet merged. This would make the command fail outright instead of only erroring out near the end.

@pradyunsg
Copy link
Member

Well, I just went ahead and merged #10560 now. I was pretty sure that we'd land that in time for the release next month, hence the choice of words. 😄

@pfmoore
Copy link
Member

pfmoore commented Mar 18, 2022

Ah, I see. Yes, that makes sense (I was thinking that we'd somehow managed to let pip actually upgrade the in-use wrapper, which I was pretty sure I would have noticed if we had 🙂)

@pradyunsg
Copy link
Member

No no, I just fixed the check I'd added years-ago, that got broken because newer Windows versions behave differently. :)

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
resolution: not a bug Determined as not a bug in pip
Projects
None yet
Development

No branches or pull requests

4 participants