Skip to content

pip: Python Package Installer

pip is the Python Package Authority’s (PyPA) standard package installer. It enables installing and managing Python packages from the Python Package Index (PyPI) and other package indexes. pip comes with modern Python installations and serves as the default tool for package operations in the Python ecosystem.

While pip remains Python’s default package installer, many workflows benefit from newer tools like uv that provide better performance and more integrated functionality.

Core Functionality

pip provides essential package management capabilities:

  • Installing packages from PyPI and other indexes
  • Uninstalling packages from environments
  • Managing requirements files
  • Installing packages in editable mode for development
  • Generating PEP 751 pylock.toml lockfiles (experimental, added in pip 25.1)
  • Installing from a pylock.toml lockfile via pip install -r pylock.toml (experimental, added in pip 26.1)
  • Installing PEP 735 dependency groups (added in pip 25.1)
  • Installing dependencies declared with PEP 723 inline script metadata (added in pip 26.0)

Key Commands

Installing Packages

# Install latest version
pip install requests

# Install specific version
pip install requests==2.31.0

# Install from requirements file
pip install -r requirements.txt

# Install a PEP 735 dependency group from pyproject.toml
pip install --group dev

# Install dependencies declared in a PEP 723 script
pip install --requirements-from-script script.py

# Install current directory in editable mode
pip install -e .

Managing Requirements

# Output installed packages
pip freeze > requirements.txt

# Install from requirements
pip install -r requirements.txt

# Generate a PEP 751 lockfile (experimental)
pip lock -r requirements.txt -o pylock.toml

# Install from a PEP 751 lockfile (experimental, pip 26.1+)
pip install -r pylock.toml

Package Information

# List installed packages
pip list

# Show package details
pip show requests

# Check environment for conflicts
pip check

Resolution Controls

# Only consider packages uploaded before a given date (pip 26.0+)
pip install --uploaded-prior-to 2025-01-01T00:00:00Z requests

# Use an ISO 8601 duration for a rolling cooldown window (pip 26.1+)
pip install --uploaded-prior-to P3D requests

# Exclude pre-releases for a specific package (pip 26.0+)
pip install --only-final fastapi

# Constrain build-time dependencies independently of runtime (pip 26.0+)
pip install --build-constraint build-constraints.txt -r requirements.txt

Note

The PIP_CONSTRAINT environment variable for build dependencies was deprecated in pip 25.3 and is scheduled for removal in pip 26.2. Use --build-constraint or PIP_BUILD_CONSTRAINT instead.

Limitations

pip has limitations to consider:

  • Lockfile support is experimental, and pip lock does not yet cover environment markers or multi-platform resolution
  • Does not manage Python interpreters or virtual environments
  • Slower package operations than uv, which resolves and installs in parallel
  • Pip 26.1 dropped support for Python 3.9; the minimum runtime is now Python 3.10

Learn More

Last updated on