Essential pip commands for Python

PIP is an acronym for Package Installer for Python. Its primary function is to install and manage software packages written in Python that may be found in the Python Package Index (PyPI). Here is a list I've compiled for quick reference.

pip commands:

Installation

pip install <package name> # install a package.

pip install pywhatkit --force-reinstall # To force reinstall

pip freeze > requirements.txt # To generate a requirements.txt file

pip install -r requirements.txt # To install packages from a requirements.txt file

pip check # To check for conflicting dependencies

pip install more options

pip install comprehensive list

Uninstall

pip uninstall <package name> # uninstall a package

pip uninstall

Update and Upgrade

python -m pip install --upgrade pip # To upgrade pip

py -m pip install --upgrade SomePackage # To upgrade package installed

Checking Installed Packages

pip --version # To know pip version

pip show requests # To check the version of an installed library/module

pip list --outdated # To identify outdated packages

Package Information

pip show --files <package name> # To display the files installed by a package

pip show --verbose <package name> # To show more information about a package

pip show --location <package name> # To show the installation location of a package

pipdeptree # To show a dependency tree of the installed packages

Miscellaneous

pip search <package name> # To search for a package

pip show <package name> # To show information about a package

pip download <package name> # To download a package without installing it

pip wheel <package name> # To create a binary wheel distribution

pip hash <package name> # To compute the hash of a package file

pip config list # To list the current configuration

pip config set <option> <value> # To set a configuration option

pip cache purge # To clear the pip cache

pip freeze # Outputs installed packages in requirements format.

pip check # Verify installed packages have compatible dependencies.

pip search <query> # Search PyPI for packages.

pip wheel <package name> # Build wheels from your requirements.

pip completion # A helper command used for command completion.

pip debug # Show information useful for debugging.

pip cache <command> # Inspect and manage pip's wheel cache.

pip config <command> # Manage local and global configuration.

pip help # Show help for commands.

Dependency Information

pipdeptree # To show a dependency tree of the installed packages

pip completion --bash # To enable bash shell completion

pip completion --zsh # To enable ZSH shell completion

Environment Information

pip debug --verbose # To display detailed information about the pip environment

Troubleshooting

pip check # To check for conflicting dependencies

pip list --outdated # To identify outdated packages

Cache Options

pip cache info # To display information about the cache

pip cache dir # To show the cache directory

pip cache purge # To clear the pip cache

pip cache remove <package name> # To remove a specific package from the cache

pip cache list # To list all packages stored in the cache

Configuration Options

pip config list # To list the current configuration

pip config set <option> <value> # To set a configuration option

pip config unset <option> # To unset a configuration option

pip config edit # To edit the pip configuration file

pip config debug # To display configuration debug information

Debugging and Testing

pip debug # Show information useful for debugging

pip debug --verbose # To display detailed information about the pip environment

pip test <package name> # To test a package

pip test --verbose <package name> # To test a package with verbose output

Download Options

py -m pip download [options] <requirement specifier> [package-index-options] ... # To download with options

py -m pip download [options] -r <requirements file> [package-index-options] ... # To download packages from a requirements file with options

py -m pip download [options] <vcs project url> ... # To download from a version control system (VCS) project URL with options

py -m pip download [options] <local project path> ... # To download from a local project path with options.

py -m pip download [options] <archive url/path> ... # To download from an archived URL or path with options

Shell Completion

pip completion --bash # To enable bash shell completion.

pip completion --zsh # To enable ZSH shell completion.

pip debug --verbose # To display detailed information about the pip environment.