I've come across situations where a current version of a package seems not to be working and requires reinstallation. But pip install -U
won't touch a package that is already up-to-date. I see how to force a reinstallation by first uninstalling (with pip uninstall
) and then installing, but is there a way to simply force an "update" to a nominally current version in a single step?
607
votes
for those looking to re-install pip it self (if it stopped working for some reason ;) ), the answer can be found in this SO q&a
– nsof
7 Answers
907
votes
221
votes
You might want to have all three options: --upgrade
and --force-reinstall
ensures reinstallation, while --no-deps
avoids reinstalling dependencies.
$ sudo pip install --upgrade --no-deps --force-reinstall <packagename>
Otherwise you might run into the problem that pip starts to recompile Numpy or other large packages.
38
votes
35
votes
10
votes
sudo pip3 install --upgrade --force-reinstall --no-deps --no-cache-dir <package-name>==<package-version>
Some relevant answers:
Difference between pip install options "ignore-installed" and "force-reinstall"
7
votes