There isn't a built-in flag yet. Starting with pip version 22.3, the --outdated and --format=freeze have become mutually exclusive. Use Python, to parse the JSON output:
Copypip --disable-pip-version-check list --outdated --format=json | python -c "import json, sys; print('\n'.join([x['name'] for x in json.load(sys.stdin)]))" | xargs -n1 pip install -U
If you are using pip<22.3 you can use:
Copypip list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U
For older versions of pip:
Copypip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U
The
grepis to skip editable ("-e") package definitions, as suggested by @jawache. (Yes, you could replacegrep+cutwithsedorawkorperlor...).The
-n1flag forxargsprevents stopping everything if updating one package fails (thanks @andsens).
Note: there are infinite potential variations for this. I'm trying to keep this answer short and simple, but please do suggest variations in the comments!
Answer from rbp on Stack OverflowThere isn't a built-in flag yet. Starting with pip version 22.3, the --outdated and --format=freeze have become mutually exclusive. Use Python, to parse the JSON output:
Copypip --disable-pip-version-check list --outdated --format=json | python -c "import json, sys; print('\n'.join([x['name'] for x in json.load(sys.stdin)]))" | xargs -n1 pip install -U
If you are using pip<22.3 you can use:
Copypip list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U
For older versions of pip:
Copypip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U
The
grepis to skip editable ("-e") package definitions, as suggested by @jawache. (Yes, you could replacegrep+cutwithsedorawkorperlor...).The
-n1flag forxargsprevents stopping everything if updating one package fails (thanks @andsens).
Note: there are infinite potential variations for this. I'm trying to keep this answer short and simple, but please do suggest variations in the comments!
To upgrade all local packages, you can install pip-review:
Copy$ pip install pip-review
After that, you can either upgrade the packages interactively:
Copy$ pip-review --local --interactive
Or automatically:
Copy$ pip-review --local --auto
pip-review is a fork of pip-tools. See pip-tools issue mentioned by @knedlsepp. pip-review package works but pip-tools package no longer works. pip-review is looking for a new maintainer.
pip-review works on Windows since version 0.5.
How to UPdate all Python-packages (pip) in one sweep?
how do you upgrade all outdated pip packages?
How can i upgrade all the installed pip packages using one line of code with as less as possible characters?
After upgrading to Python 3.11.3, all my user global packages are gone.
The problem is, I didn't have a backup list of it. My question is, is there a history of user installed python packages?
Yes, it's here: $HOME/.local/lib/python3.10/site-packages
Do this:
pip install $(pip list --path $HOME/.local/lib/python3.10/site-packages --format=freeze | sed 's/==.*//') -U
EDIT: It's possible that some python3.10 AUR packages are still lingering around. You can get a list of them by running pacman -Qoq /usr/lib/python3.10/site-packages and then reinstall them all.
Videos
pip freeze -o > requirements.txt
output:
Usage: pip freeze [options] no such option: -o
i want to convert all the outdated pip packages to a requirements format and contain it into requirements.txt.
» pip install pip-upgrade-tool