Pip upgrade all packages at once with a one-liner command

pip upgrade all
Image: pip upgrade all (License: CC-BY-SA Marcelo Canina)

pip upgrade all the virtual environment packages

Last modified:
Tags: python, django, pip


If you are using Python there is a high chance you are using virtual environments, and also probably you are using PIP1.

When working with these projects you start working with a requirements.txt file where all your packages versions being used are defined, which starts growing with time and some packages starts to be outdated.

Unfortunately there is no command to upgrade all of them at once and be up to date with all your project dependencies.


This is a Linux one-liner that takes all the contents of the requirements file and upgrades them one by one..


Let's explain how that command works.

  • pip3 list -o: shows the outdated packages
    • --format columns: specifies how to print the output
  • cut -d' ': split the input by spaces
    • -f1: and take the first field of each line
  • xargs -n1: use at most 1 arg by command line
    • pip install -U: upgrade the package


  1. The PyPA recommended tool for installing Python packages

Marcelo Canina
I'm Marcelo Canina, a developer from Uruguay. I build websites and web-based applications from the ground up and share what I learn here.
comments powered by Disqus

This article shows a one-liner command to upgrade all the packages present in PIP's requirements.txt file at once.

Clutter-free software concepts.
Translations English Espa簽ol