Downgrading or installing earlier version of a package with pip

Viewed 3183

I have a version of a package installed (e.g. transformers 3.4.0) I want to install an earlier one. I install with:

pip install transformers==3.1.0

When checking installed versions with

pip freeze

I see the version did not change.

2 Answers

Although not intuitive, "upgrade" means to ignore the exact version and ignore the current one if not the same. So, you need to "upgrade" to the earlier version for example:

pip install --upgrade transformers=3.1.0

upgrade can be used for both downgrades or upgrades.

pip install --upgrade transformers==3.1.0

If you want to play it safe, you can

pip uninstall transformers
pip install --upgrade transformers==3.1.0

upgrade works with -t --target parameter as well.

pip install --target lib --upgrade transformers==3.1.0
Related