==== install a package ====
pip install --ignore-installed PyYAML
Ref:- https://stackoverflow.com/questions/53807511/pip-cannot-uninstall-package-it-is-a-distutils-installed-project
==== install a specific version of a package ====
pip install ==
For example
pip install pandas==1.5.3
==== reinstall an existing package ====
pip install --upgrade --force-reinstall
* https://stackoverflow.com/questions/51913361/difference-between-pip-install-options-ignore-installed-and-force-reinstall - explains the difference between --force-reinstall and --ignore-installed
==== pip cache ====
install a package without using the cache, just for this run.
pip install --no-cache-dir
configure pip to not use the cache "globally" (in all commands)
pip config set global.cache-dir false
remove all wheel files related to matplotlib from pip's cache.
pip cache remove matplotlib
clear all files from pip's cache.
pip cache purge
pip cache directory
pip cache dir
Availability: {'pip cache': 'pip >= 20.1', 'pip config': 'pip >= 10.0', '--no-cache-dir': 'pip >= 6.0'}
Ref:-
* https://stackoverflow.com/a/61762308/6305733 - response from a pip maintainer.
==== upgrade pip ====
python -m pip install --upgrade pip
==== links I came across ====
* https://caremad.io/posts/2013/07/setup-vs-requirement/ - setup.py vs requirements.txt - an article by Donald Stufft
* Easy to understand, well written.
* found it in https://pip.pypa.io/en/stable/user_guide/#requirements-files
* Changes to the pip dependency resolver in 20.3 - https://pip.pypa.io/en/stable/user_guide/#changes-to-the-pip-dependency-resolver-in-20-3-2020
* https://pip.pypa.io/en/stable/news/ - pip changelog