-
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 install -U pip
in venv suggests adding --user
flag on Windows
#8247
Comments
I'm running in to this too on an Azure Windows job:
I'll try playing with different ways of calling this with different versions and see what happens. |
Setting my code to install |
Specifying --user will result in updating the user-wide pip install, not the pip in the virtual environment. I did check that. I also remember seeing a github ticket about what behavior --user should have when using pip inside a virtual environment. I believe the consensus was that it should install a package to the user site-packages not to the environment. I could be wrong, but given that pip is using a new wheel file for the new pip version, I don't believe this issue is related to out of tree builds (#7555 and #8221). |
@djhoese it does seem like what you're hitting is a bug, albeit a different one. On Windows, an executable cannot be deleted while it is running. However, there is supposed to be code in pip, that is supposed to protect against hitting the issue of "try to delete pip.exe while running on pip.exe" on Windows, and suggest using I suggest changing (or getting the project you're using to make a change) to use Additionally, could you please file a new issue describing how to reproduce this issue? |
@pradyunsg Thanks. You're right the |
Environment
Python 3.8.2 is a user-only install from the Python.org 64-bit Windows .exe installer, installed to
%LOCALAPPDATA%\Programs\Python\Python38
.Description
When I run
pip install -U pip
in a virtual environment (created builtin venv module), I get an error message sayingIt actually does succeed in upgrading pip in the virtual environment despite the error message. It appears that what it fails to do is clean up the
%LOCALAPPDATA%\Temp\pip-uninstall-xxxxxxxx\
temporary folder.I do not get this error message when I want to upgrade the site-wide pip (
py -m pip install -U pip
) or the user pip (py -m pip install --user -U pip
).I also do not get an error message like this in virtual environments on Linux.
Expected behavior
I expect the virtual environment's pip to be able to upgrade itself without producing any error messages or leaving behind any temporary files.
How to Reproduce
py -3.8 -m venv testenv
.\testenv\Scripts\pip.exe --version
. Reportspip 19.2.3 from c:\users\myusername\desktop\testenv\lib\site-packages\pip (python 3.8)
pip-*
folders in%LOCALAPPDATA%\Temp\
.\testenv\Scripts\pip.exe install -U pip
. Error message appears.\testenv\Scripts\pip.exe --version
. Reportspip 20.1 from c:\users\myusername\desktop\testenv\lib\site-packages\pip (python 3.8)
pip-uninstall-*
folder in%LOCALAPPDATA%\Temp\
Output
Here is the output of running the above commands (omitting the installation of Python):
For good measure I'll add output here of re-installing pip 19.2.3 into the virtualenv , then reproducer steps just adding the verbose flag to
pip install -U pip
this time.I'll also add ellipses to cut out some of the "Found link https://files.pythonhosted.org..." lines
The text was updated successfully, but these errors were encountered: