-
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 update command - No response from CLI on Windows #4268
Comments
This seems to be a Windows batch programming issue, not a pip problem. Your requirements.txt file seems to include "Terminate batch job (Y/N)?" which is output you get if your batch file has an error. I suspect you aren't handling errors properly in the process that generates your requirements.txt file. I'd suggest reading requirements.txt to see if it contains error output from your batch script, and if so, fix those errors. |
I'm not running a batch script. I'm simply opening an Admin CMD prompt and typing in the following But you are right when I run the first command It adds that line "Terminate batch job (Y/N)?" to the end? Why is that? I've also tried running the following: C:\WINDOWS\system32>cd c:\python27 c:\Python27>for /F "delims===" %i in ('pip freeze -l') do pip install -U %i But the CMD prompt doesn't do anything, it's not froze, it just sits there. I CAN update all the packages manually by running: pip install --upgrade |
Honestly, I don't know. This isn't really the right place to get help with windows batch file programming. You said your batch file contained:
That's odd, as You should probably ask for further help on a Windows batch programming forum. I'm going to close this as it doesn't appear to be a pip issue. |
@pfmoore - I got you. I expected that answer. This started happening when I recently updated a few packages, so I know it's a python/pip issue. I understand they aren't builtin commands, but I'm running python and PIP from the python emulator and it's still doing it. Again, it's not a batch command, I'm simply running it from a CMD prompt. I copied the command line from here: http://stackoverflow.com/questions/2720014/upgrading-all-packages-with-pip/3452888#3452888 I guess I'll look in a windows-based source. THX |
Yep, that's a Unix command line. Not suitable for you at all. If you want a powershell command (I'm not sure how to do it in CMD, as the CMD syntax is horrid...) to get the list of packages you have installed,
should do the job. Your problem text was in a requirements.txt file, and I don't see where that was coming from - Hope some of that helps. |
@pfmoore - when I run python -m pip freeze | % { ($_ -split '==')[0] } in PS, nothing happens. It returns to the line below and does absolutely nothing. With all do respect. this is not a CLI issue. There's something that is hanging up the command from running, or the output from being displayed. |
OK. In which case I'm baffled. Does |
@pfmoore Yes, it does, see below. I'm baffled too. I may be a NOOB, but I know the basics. Also, if I do python2.7 -m pip freeze > requirements.txt The CMD prompt will hang , but it WILL produce a requirments.txt file. python -m pip freeze: Microsoft Windows [Version 10.0.14393] C:\WINDOWS\system32>cd c:\python27 c:\Python27>python -m pip freeze |
@seanvree OK. I wasn't implying that you didn't know what you were doing, just trying to follow what's happening. The output you gave is useful. From the You say you try The one puzzle I'm still having trouble with is why |
@pfmoore - if you have python for windows installed and add it to your PATH, then you can run all py commands natively by simply typing "PYTHON" Again, it's NOT a bat file sir. I can simply type "PYTHON" in CMD window/PS and I get the output as follows: Microsoft Windows [Version 10.0.14393] C:\WINDOWS\system32>python Yes, I get the same output in PS as in CMD. |
@seanvree I understand that (I've used Python on Windows for many years now). But you said you did So the question remains, where did you get that python2.7 command from? You need to check each directory in PATH, plus your current directory to see if there's a python2.7.{exe, com, cmd, bat} file in there. If the
to show the location of the file that the shell is using for |
@pfmoore there is if you install this: https://github.com/davidmarble/pywin The "Python2.7" command simply allows you to run diff python commands for diff python versions installed on your box. which I do. So, I can run "python2.7 -m pip ext etc" and that would run pip under 2.7 "Python3.6 -m pip etc etc" that would invoke the command for the 3.6 install. If I run If I run get-command python2.7 | Select-Object Source I get the following output: Windows PowerShell PS C:\Users\Administrator> get-command python2.7 | Select-Object Source SourceC:\Python27\python2.7.bat PS C:\Users\Administrator> That .bat file shows: @C:\Python27\python.exe %* |
Ah, OK. That's your problem then. You do know that as |
Right, that's actually what I was doing originally when it stopped working. So, I should be able to do: call python2.7 -m pip freeze --local | grep -v '^-e' | cut -d = -f 1 | xargs -n1 pip install -U Right? Because it still hangs. |
Well, grep, cut and xargs still aren't Windows programs. And I know xargs tends to be flaky (it depends on the build - talk to whoever supplied your port of xargs). And The single quotes in the grep command arguments I already commented on. I think I've gone as far as I can here. It's still clear to me that this isn't a pip issue, so you should look for help from a Windows forum, or from whoever supplied the various utilities you are using. Hope I've been of some help, at least. |
@pfmoore - Thanks so much for your help. I respectfully disagree with you, however. I know it's not an input/command issue. Been using the exact same commands for 2 years with no issues and as soon as I updated the entire python/pip package, something broke. Cheers sir. |
OK, well if you can demonstrate the pip issue without side issues of non-standard batch launchers and 3rd party commands, please feel free to reopen the issue with a reproducible test case. At the moment, I can't see from your report any evidence of a pip issue that we can action. |
@pfmoore - Okay, fair. So let me simply ask you this: How do you update all pip packages on windows with one or two commands? |
Mostly I don't, because some are hard to do (need compilers, come from Christoph Gohlke's site). And there's an ongoing debate over possibly adding a
I just did precisely that now, and it worked perfectly. In practice, I mostly just do Note though that blindly updating like this risks breaking dependencies, as pip doesn't do a full recursive dependency analysis/check when doing this sort of update (there's open issues around this under titles like "pip needs a dependency resolver" - a quick search found #988 and #2716, but there may be more - work is ongoing). You should test your installation after doing this. |
@pfmoore - Yup. got it. That command does not work from PS. Same thing, just hangs. |
Weird. It works for me so I guess there's something up with your environment. Sorry I've no idea what it might be. |
Description:
I have python 2.7 and python 3.6 installed With all the python tools. I can run python scripts all day.
So, I created a bat file that will do this for me once a day, code is the following:
python2.7 -m pip freeze --local | grep -v '-e' | cut -d = -f 1 | xargs -n1 pip install -U
So, when I put this in a windows CLI with admin priv, it just hangs after the command is passed. The CMD window is NOT froze, it just sits there and does nothing.
I can try this with the 3.6 python as well, and it does the same thing:
call python3.6 -m pip freeze --local | grep -v '-e' | cut -d = -f 1 | xargs -n1 pip install -U
I've tried powershell as well and it does the same thing.
Now, I CAN update the packages one by one using PIP, but that's too much.
What am I doing wrong?
What I've run:
The text was updated successfully, but these errors were encountered: