Pip notes
From raju
Contents
pip cache
- install a package without using the cache, just for this run.
- pip install --no-cache-dir <package>
- 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
reinstall an existing package
pip install --upgrade --force-reinstall <package>
- https://stackoverflow.com/questions/51913361/difference-between-pip-install-options-ignore-installed-and-force-reinstall - explains the difference between --force-reinstall and --ignore-installed
search exact match
pip search $pkg |& grep "^$pkg ("
tags | search available versions
Example:
-
Default behaviour:
$ pkg=fastavro $ pip search $pkg fastavro-codecs (0.1.0.dev0) - Fastavro codecs. fastavro (0.22.3) - Fast read/write of AVRO files
When the results are grepped:
$ pip search $pkg |& grep "^$pkg (" fastavro (0.22.3) - Fast read/write of AVRO files
easy_install
Easy Install is deprecated. Do not use it. Use pip instead.
Ref:- https://setuptools.readthedocs.io/en/latest/easy_install.html
useful links
- https://pip.pypa.io/en/stable/news/ - pip changelog