pip-list
List installed Python packages
TLDR
List installed packages
List outdated packages that can be upgraded
List up-to-date packages
List packages with JSON formatting
List packages that are not required by other packages
List packages installed in user-site only
List packages and exclude editable packages from output
List packages in freeze format (unlike pip freeze, does not show editable install information)
SYNOPSIS
pip list [options]
PARAMETERS
-i, --outdated
Lists packages that have newer versions available on PyPI.
-u, --uptodate
Lists packages that are up-to-date with the latest versions on PyPI.
-e, --editable
Lists packages that are installed in editable (development) mode.
-l, --local
If within a virtual environment, this option restricts the list to locally-installed packages, excluding globally-installed ones.
--user
Displays only packages installed in the user site directory, rather than system-wide or environment-specific installations.
--path path
Restricts the package listing to a specified installation path. This is useful for inspecting non-standard installation locations.
--pre
Includes pre-release and development versions of packages in the output. By default, pip only finds stable versions.
--format format
Specifies the output format. Permitted values include columns (default), freeze (suitable for requirements files), or json (for machine-readable output).
--not-required
Lists packages that are not dependencies of any other installed packages.
--exclude-editable
Excludes packages installed in editable mode from the output.
--include-editable
Explicitly includes editable projects in the output (this is often the default behavior).
-o, --output-file path
Redirects the command's output to the specified file instead of standard output.
-q, --quiet
Suppresses non-error messages, resulting in less verbose output.
-v, --verbose
Provides more detailed output, showing additional information about the operation.
-h, --help
Displays a help message for the pip list command and exits.
DESCRIPTION
The pip list command is a fundamental utility within the Python package installer (pip) ecosystem. It serves to display a comprehensive inventory of all Python packages currently installed in the active environment, alongside their respective version numbers. This command is indispensable for Python developers and system administrators alike, offering a quick and clear overview of the project's dependencies. It helps in verifying successful package installations, identifying outdated components that might require updates, and understanding the precise set of libraries available for a given Python application. By providing crucial visibility into the installed software, pip list plays a key role in maintaining a consistent, healthy, and manageable Python development or deployment environment.
CAVEATS
- Environment Context: The output of pip list is highly dependent on the active Python environment (e.g., global installation, virtual environment, Conda environment). Packages installed in one environment will not automatically appear when a different environment is active.
- Package Management: While pip list shows installed packages, it doesn't manage them directly. For installation, uninstallation, or upgrades, other pip commands like pip install, pip uninstall, or pip install --upgrade are used.
- Editable Installs: Packages installed in "editable" mode (e.g., pip install -e .) are typically listed, but their source location is indicated rather than a standard version number. Options like --editable or --exclude-editable can filter these.
- Output Parsing: When programmatically parsing pip list output, especially with the default columns format, it's safer to use the --format json or --format freeze options for stable and easily parseable data.
INTERPRETING OUTPUT
By default, pip list displays package names and versions. If a package is outdated, pip list --outdated will show its current version and the latest available version, helping users identify potential upgrades. Editable installs (indicated by -e or their path) show their local source path instead of a version number, signifying they are installed directly from a local repository for development.
VIRTUAL ENVIRONMENTS
It's highly recommended to use pip list within a Python virtual environment. This practice ensures you're inspecting packages relevant to a specific project, thereby avoiding conflicts or confusion with globally installed packages that might not be used by your current application.
COMMON USE CASES
- pip list: Get a quick overview of all packages installed in the current environment.
- pip list --outdated: Easily check which packages have newer versions available for upgrade.
- pip list --format freeze > requirements.txt: Although pip freeze is more commonly used for this, pip list with --format freeze can generate a requirements.txt file for reproducing environments.
- pip list --format json: Obtain machine-readable output, ideal for scripting and automated environment checks.
HISTORY
The pip project, initially a fork of setuptools' easy_install, was created around 2008 by Ian Bicking. Its list command has been a core feature from early versions, providing a simple and consistent way to inventory installed Python packages. Over time, new options like --outdated, --format json, and environment-specific filters have been added to enhance its utility for various development and deployment workflows, reflecting the growing complexity of Python dependency management.


