Search code examples
pippackageupgrade

upgrade all outdated pip packages discarding failures


I have a bash command to upgrade all pip packages that I installed.

The command is:

pip3 list --outdated | cut -d' ' -f1 | tail -n +3 | xargs pip3 install --upgrade

The problem is that if one of the packages fails to upgrade, it rolls back deleting the upgrades of the ones that were successful upgraded.

Is there a way to upgrade all outdated packages with a single command discarding the failures of some packages?


Solution

  • I slightly modified the command posted in the duplicate of link.

    pip3 list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1  | xargs -n1 pip3 install -U --user