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

enable pip to upgrade all outdated packages #3819

Closed
walchko opened this issue Jun 26, 2016 · 28 comments
Closed

enable pip to upgrade all outdated packages #3819

walchko opened this issue Jun 26, 2016 · 28 comments

Comments

@walchko
Copy link

walchko commented Jun 26, 2016

  • Pip version: all
  • Python version: all
  • Operating System: all

Description:

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.

What I've run:

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
@picibucor
Copy link

It does not work for Windows 7

@OskarCarl
Copy link

OskarCarl commented Sep 8, 2016

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.

@RonnyPfannschmidt
Copy link
Contributor

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

@OskarCarl
Copy link

Sorry, I had no idea. I've edited my original comment.

@xavfernandez
Copy link
Member

Closing as duplicate of the requested upgrade-all command (cf #59)

@its0x08
Copy link

its0x08 commented Dec 6, 2016

pip freeze > requirements.txt && pip install --upgrade -r requirements.txt && rm requirements.txt
super easy !

@picibucor
Copy link

picibucor commented Dec 6, 2016

on win:
pip freeze > requirements.txt && pip install --upgrade -r requirements.txt && del requirements.txt

@its0x08
Copy link

its0x08 commented Dec 6, 2016

@picibucor : i see -r if u dont is ur problem!

@picibucor
Copy link

@its0x08 : My bad, sorry.

@gwerbin
Copy link

gwerbin commented Feb 16, 2017

@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.

@pfmoore
Copy link
Member

pfmoore commented Feb 16, 2017

Two comments.

  1. 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).
  2. Doing this will upgrade everything to the latest versions, which won't necessarily respect dependencies. For example, bleach depends on 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.

@nschloe
Copy link

nschloe commented Mar 15, 2017

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.

@wblondel
Copy link

wblondel commented Apr 2, 2017

Thanks a lot @nschloe !

@partounian
Copy link

partounian commented Apr 11, 2017

@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.

@nschloe
Copy link

nschloe commented Apr 11, 2017

@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.

@simion
Copy link

simion commented Apr 26, 2017

I've released a nice interactive pip requirements upgrader: https://github.com/simion/pip-upgrader

@walchko
Copy link
Author

walchko commented Apr 26, 2017

@simion good job! 😃

@simion
Copy link

simion commented Apr 26, 2017

@walchko thanks! Looking forward to receive feedback and improvement ideas :)

@texadactyl
Copy link

texadactyl commented Jun 11, 2017

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???

@goetzc
Copy link

goetzc commented Jul 7, 2017

You can see above:

Closing as duplicate of the requested upgrade-all command (cf #59)

And there is also "Add an upgrade-all command" #4551

@pradyunsg
Copy link
Member

@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.

@Jermic
Copy link

Jermic commented Jul 19, 2017

python3.6

pip list -o | cut -d " " -f 1 | tail -n +3 | xargs pip install -U

@flawiddsouza
Copy link

flawiddsouza commented Aug 8, 2017

In PowerShell

pip list --outdated --format=freeze | %{$_.split('==')[0]} | %{pip install --upgrade $_}

@xiaoshuai
Copy link

xiaoshuai commented Jan 2, 2018

i use pip list --format=legacy --outdated | cut -d' ' -f1 | xargs pip install --upgrade work fine

@ak4nv
Copy link

ak4nv commented Apr 25, 2018

pip list --format freeze | sed 's/==.*$//g' | xargs pip install -U

@paidhi
Copy link

paidhi commented May 4, 2018

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.

@xa0082249956
Copy link

In PowerShell without pipelines.

pip install --upgrade ((pip freeze) -replace '==.+','')

@pradyunsg
Copy link
Member

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.

@pypa pypa locked as resolved and limited conversation to collaborators May 16, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests