-
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
windows in-place pip upgrades #1299
Comments
Use Personally, I consider this to be a minor issue - telling people to use `python -m pip`` seems to me to be a perfectly acceptable answer, given that the issue is fundamental to how Windows handles deletion of open files. Ultimately it's going to be a question of how much complexity (with the consequent maintenance cost) and risk we want to take on in order to solve this. |
Personally i'm ok with |
I was just about to say the same thing. Here's a question - would you want that message to only appear on Windows, or would it be reasonable to say the same on Unix (for a consistent user experience). Personally, I'd like to be consistent across platforms (because it's easier to document that way). Also, we should trap any command that attempts to (re-)install pip - |
Personally I think it should be windows only. I view it as a work around for the way the Windows platform works, and something that's a target to eventually remove for something nicer down the road. |
I knew you were going to say that :-( Frankly, I don't believe we will ever get "something nicer", basically because we don't have enough Windows expertise to develop and maintain it. I know of no Windows software with a satisfactory self-replacement of executables solution. I certainly don't have an answer, and I wouldn't expect any of the Unix-based developers to be able to help. Even if we did get something, it's likely to be complex and so a probable source of bit rot and obscure bugs. Making a solution that works on all platforms the "official answer" seems to me to avoid sending confusing messages to the user. Back it up with a warning as described and we have a robust solution, even if it's not quite as perfect as getting Please excuse a certain level of mild grumpiness in this reply, caused by a feeling that it's always the Windows platform that has to be the one to compromise - I don't mean to make an issue out of this. In practice, I'll go with whatever the consensus is. I don't think it's a big deal. |
FWIW my goal after PEP453 is done is to get our own testing infrastructure stood up which includes Windows, so hopefully that'll solve some of the windows bitrot problems. I can understand the grumpyness though :) If we were designing this system brand new I'd be a lot more amendable to that but I don't think it's user friendly to break |
OK, that sounds fair. You're right that historical usage is more important here. I actually have no feel at all for what the user experience on Unix is, so I'm probably just as guilty of one-sided thinking as anyone else. I must try to see how using Python on Linux feels - is there a good "Python on Linux for beginners" resource that shows how to set up a Python (3) environment, get the various tools set up, etc? [One thing I always find doesn't get covered, is how to make "python" run Python 3 by default, how to make "virtualenv" build Python 3 virtualenvs by default, all that sort of thing - it seems to me that Python 3 is much more second-class on Unix than on Windows, oddly enough.] |
Typically you don't want to make |
Hmm, I'm not talking at a system level, but really you can't choose what to use for Python in your personal account? That definitely makes Python 3 second-class, to my way of thinking... But it does explain why Unix users don't seem to find using things like "pip3" or "pip3.3" as ugly as sin :-) (Anyway, we're way off-topic here, so never mind). |
You can setup your shell so it has ~/bin/ before the system bin and add a symlink there from python to python3, but yea offtopic. I'm happy to help though if you're actually interested in getting things set up :] IRC or Email. |
My work which I believe Paul was referring to was just to implement the 'deleteme' dance for replacing files in use (i.e. exe wrappers) - that's in |
So perhaps this is already solved for Wheels? And it's a setuptools problem elsewise? |
Sounds possible. I'll do some tests today, if I can. |
Sadly not, at least with "pip install -I pip". (It's hard to test an actual upgrade, as only the absolute latest version of pip has script wrapper support):
|
So |
I suspect it's because we do an uninstall then an install, rather than an install overwriting what's there (for obvious reasons). |
Windows doesn't allow overwriting or deleting open exe files, but it does allow renaming/moving them. |
Well, with some tomfoolery with the Win32 API you can close the handle to |
I don't think you can close all handles to the currently running exe. But if you have working code as an example, I'd love to see it, as this has long been a problem that people have debated and the consensus has always been that it's not possible (except by tricks like "rename and delete later"). Working code that does this would be extremely useful to the community. |
Run into the same issue. As a quick hack, can pip.exe detect that it is being upgraded prior to execution and restart itself with |
I don't think that actually works. But maybe a stupid thought, afaik the .exe doesn't need to be updated, can we just special case pip.exe and leave it alone? Would possibly leave a pip.exe laying around after an install though. |
@dstufft correct, "restarting yourself" isn't as simple as @techtonik makes it sound on Windows, where there's no equivalent of the Unix Technically, BTW, we're going round in circles here. According to Vinay's earlier comments, this is solved in distlib (which is where I think it should be solved) but pip doesn't use the API in a way that allows it to work. If we could use the distlib solution, then great. Otherwise, we need someone to write a pip-specific solution (and I remain skeptical that this can be done in a robust, maintainable manner that isn't far more complex than the issue warrants). Suggestion:
I think we're at the stage where actual working code is the only thing that will move this issue forward. |
I am not sure how to detect that pip is run as pip.exe
I am -1 on bloating the docs without trying other solutions. |
I'm +1 on documenting what works right now. |
Even with doc comment it is still workaround - not a solution, and you've got command prompt for Windows wrong. |
Maybe this is crazy but I always just do this:
of course this requires one to have libcurl, but there are windows binaries available here. |
Don't run `pip install --upgrade pip` on Windows, it started to fail in our Jenkins node and this is not the right command. https://jira.mesosphere.com/browse/DCOS_OSS-2332 https://pip.pypa.io/en/stable/installing/#upgrading-pip pypa/pip#1299
Don't run `pip install --upgrade pip` on Windows, it started to fail in our Jenkins node and this is not the right command. https://jira.mesosphere.com/browse/DCOS_OSS-2332 https://pip.pypa.io/en/stable/installing/#upgrading-pip pypa/pip#1299
Don't run `pip install --upgrade pip` on Windows, it started to fail in our Jenkins node and this is not the right command. https://jira.mesosphere.com/browse/DCOS_OSS-2332 https://pip.pypa.io/en/stable/installing/#upgrading-pip pypa/pip#1299
Don't run `pip install --upgrade pip` on Windows, it started to fail in our Jenkins node and this is not the right command. https://jira.mesosphere.com/browse/DCOS_OSS-2332 https://pip.pypa.io/en/stable/installing/#upgrading-pip pypa/pip#1299
Don't run `pip install --upgrade pip` on Windows, it started to fail in our Jenkins node and this is not the right command. https://jira.mesosphere.com/browse/DCOS_OSS-2332 https://pip.pypa.io/en/stable/installing/#upgrading-pip pypa/pip#1299
Don't run `pip install --upgrade pip` on Windows, it started to fail in our Jenkins node and this is not the right command. https://jira.mesosphere.com/browse/DCOS_OSS-2332 https://pip.pypa.io/en/stable/installing/#upgrading-pip pypa/pip#1299
Don't run `pip install --upgrade pip` on Windows, it started to fail in our Jenkins node and this is not the right command. https://jira.mesosphere.com/browse/DCOS_OSS-2332 https://pip.pypa.io/en/stable/installing/#upgrading-pip pypa/pip#1299
So for now if I've installed python without pip I will not be able to install pip module in future?
|
Hey @ihormelnyk! That's not the case. The conditional for this was too broad -- it blocks using any script with the word "pip" in it from modifying pip. You can try renaming get-pip.py to not contain the word "pip", to work around this issue. A 10.0.1 release (which will likely happen this week) will fix this issue. |
@pradyunsg thanks for sharing the tip. I had the same issue as @ihormelnyk and renaming the |
I print pip in cmd inwindows,but it showed |
pradyunsg said 10.0.1 would fix this, but i don't know how. Thanks.
|
That'll be the same as #5343. |
Thanks pradyunsg, Someone else's solution turns out to be simpler. Just performed "python -m pip uninstall pip" first, then "python -m pip install -U pip" Requirement already up-to-date: pip in c:\user\clarkk\appdata\local\Programs\Python\Python36\lib\site-packages (10.0.1) |
Don't run `pip install --upgrade pip` on Windows, it started to fail in our Jenkins node and this is not the right command. https://jira.mesosphere.com/browse/DCOS_OSS-2332 https://pip.pypa.io/en/stable/installing/#upgrading-pip pypa/pip#1299
|
@AProNoob You should be running the commands at a command prompt (cmd or powershell), not at a Python prompt. |
Thanks! That worked! |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
not sure of the status of
pip install --ugrade pip
on windows.need this for PEP453
@pfmoore ?
see #188 for an old discussion on this.
The text was updated successfully, but these errors were encountered: