Is it possible to upgrade all Python packages at one time with pip
?
Note that there is a feature request for this on the official issue tracker.
Is it possible to upgrade all Python packages at one time with pip
?
Note that there is a feature request for this on the official issue tracker.
use awk update packges:
pip install -U $(pip freeze | awk -F'[=]' '{print $1}')
windows powershell update
foreach($p in $(pip freeze)){ pip install -U $p.Split("=")[0]}
one line in powershell 5.1 with adm rights, python 3.6.5 and pip ver 10.0.1:
it works smoothly if there are no broken packages or special wheels in the list...
I had the same problem with upgrading. Thing is, i never upgrade all packages. I upgrade only what i need, because project may break.
Because there was no easy way for upgrading package by package, and updating the requirements.txt file, i wrote this pip-upgrader which also updates the versions in your
requirements.txt
file for the packages chosen (or all packages).Installation
Usage
Activate your virtualenv (important, because it will also install the new versions of upgraded packages in current virtualenv).
cd
into your project directory, then run:Advanced usage
If the requirements are placed in a non-standard location, send them as arguments:
If you already know what package you want to upgrade, simply send them as arguments:
If you need to upgrade to pre-release / post-release version, add
--prerelease
argument to your command.Full disclosure: I wrote this package.
The following one-liner might prove of help:
pip list --format freeze --outdated | sed 's/(.*//g' | xargs -n1 pip install -U
xargs -n1
keeps going if an error occurs.If you need more "fine grained" control over what is omitted and what raises an error you should not add the
-n1
flag and explicitly define the errors to ignore, by "piping" the following line for each separate error:| sed 's/^<First characters of the error>.*//'
Here is a working example:
My script:
You can use the following Python code. Unlike
pip freeze
, this will not print warnings and FIXME errors. For pip < 10.0.1For pip >= 10.0.1