I would like pip
to upgrade all outdated packages identified by pip list --outdated
in one simple command. It would also be nice to have pip outdated
show the outdated package too.
this works for me (so far), but from a usability stand point, people shouldn't have to do this just to keep their packages up to date:
pip list --outdated | cut -d' ' -f1 | xargs pip install --upgrade
It does not work for Windows 7
Well, cut and xargs are linux command line tools so it can't be expected to simply work on Windows. You would need Windows equivalents of those or maybe something like cygwin. Ignore this.
note that this is completely broken for pip style installers
unlike a linux distribution where a set of packages goes trough release and maintenance processes, with QA
pypi is a package index, not a quality assured distribution
please dont pretend it can be used like one
Sorry, I had no idea. I've edited my original comment.
Closing as duplicate of the requested upgrade-all
command (cf #59)
pip freeze > requirements.txt && pip install --upgrade -r requirements.txt && rm requirements.txt
super easy !
on win:
pip freeze > requirements.txt && pip install --upgrade _-r_ requirements.txt && _del_ requirements.txt
@picibucor : i see -r
if u dont is ur problem!
@its0x08 : My bad, sorry.
@its0x08 you can do this in a Bash-flavored shell without creating a temporary file using "process substitution":
pip install --upgrade -r <( pip freeze )
Under the hood, this creates a temporary "named pipe" and then deletes it immediately after.
Two comments.
pip freeze
includes exact versions, so it won't upgrade as written (you'd need to add a step to strip out the version constraints).html5lib (>=0.999,!=0.9999,!=0.99999,<0.99999999)
, but pip install --upgrade bleach html5lib
will install html5lib-0.999999999
. This is the "pip needs a dependency resolver" issue.For anyone who's tired googling that command line, I've added a command line tool to pipdate. Simply
sudo -H pip install pipdate
and then
sudo -H pipdate
anytime you like.
Thanks a lot @nschloe !
@nschloe How does that work for pip2 vs pip3? How can I run that for the nondefault pip?
EDIT: Example usage
sudo -H pipdate3
but I don't think this is necessary.
@partounian
How can I run that for the nondefault pip?
Not sure what you mean, but if you file an issue over at https://github.com/nschloe/pipdated I'd be happy to discuss it.
I've released a nice interactive pip requirements upgrader: https://github.com/simion/pip-upgrader
@simion good job! :smiley:
@walchko thanks! Looking forward to receive feedback and improvement ideas :)
All of the above is exactly why pip
should be modified by the maintainers to support an "upgrade-all-outdated" function that works on all platforms, similar to apt dist-upgrade
on Debian-like Linux systems. The danger of work-arounds is that they tend to become obsolete and not work everywhere.
Why is this issue closed???
You can see above:
Closing as duplicate of the requested upgrade-all command (cf #59)
And there is also "Add an upgrade-all command" https://github.com/pypa/pip/issues/4551
@texadactyl As @goetzc said, this issue was closed as a duplicate of #59.
The discussion for adding an upgrade-all command would be done in #4551 but that is currently blocked by #988.
python3.6
pip list -o | cut -d " " -f 1 | tail -n +3 | xargs pip install -U
In PowerShell
pip list --outdated --format=freeze | %{$_.split('==')[0]} | %{pip install --upgrade $_}
i use pip list --format=legacy --outdated | cut -d' ' -f1 | xargs pip install --upgrade
work fine
pip list --format freeze | sed 's/==.*$//g' | xargs pip install -U
This should work on multiple platforms (including Windows):
pip install --upgrade $(pip list --outdated --format=json | jq '.[].name' --raw-output)
The jq executable is available for many platforms.
In PowerShell without pipelines.
pip install --upgrade ((pip freeze) -replace '==.+','')
Hey everyone!
pip currently doesn't have a proper resolver (#988) which means that you can't be sure that installing a new package won't break a package. This means most of the commands listed here will likely break your environment in some weird way.
That said, we have a tracking issue for upgrade-all command (#4551) so I suggest you subscribe to that issue for updates on this topic.
Most helpful comment
For anyone who's tired googling that command line, I've added a command line tool to pipdate. Simply
and then
anytime you like.