pip list --outdated is actually a snapshot of what your local environment thinks is outdated, not necessarily what’s truly outdated on PyPI.

Here’s how it works in practice. Imagine you have a project where you’ve pinned a dependency:

# requirements.txt
requests==2.28.1
flask==2.2.2

You install these:

pip install -r requirements.txt

Now, let’s say requests has released 2.29.0 and flask has released 2.2.3. You run pip list --outdated:

$ pip list --outdated
Package    Version Latest Type
---------- ------- ------ -----
Flask      2.2.2   2.2.3  wheel
requests   2.28.1  2.29.0 wheel

It correctly identifies that newer versions are available. But what if you’re working on a different project, or just want to check the global Python environment?

$ pip list --outdated
Package    Version Latest Type
---------- ------- ------ -----
numpy      1.23.5  1.24.2 wheel
pandas     1.5.3   1.6.1  wheel
scipy      1.10.0  1.10.1 wheel

This command queries the installed packages against the latest versions available on the Python Package Index (PyPI). It’s a simple but crucial tool for maintaining a healthy and secure development environment.

The problem pip list --outdated solves is the drift between the packages you have installed and the latest stable or secure versions available. Over time, security vulnerabilities are discovered and patched, performance improvements are made, and new features are added. Without a way to easily identify outdated packages, you’d be stuck using potentially insecure or less efficient software.

Internally, pip list --outdated performs a few key operations:

  1. Inventory Installed Packages: It scans your current Python environment (virtual environment or global site-packages) to get a list of all installed packages and their exact versions.
  2. Query PyPI: For each installed package, it makes a request to the PyPI Simple API (e.g., https://pypi.org/pypi/<package_name>/json) to fetch metadata about the package, including its latest released version.
  3. Compare Versions: It compares the installed version with the latest version reported by PyPI. If the latest version is a higher number than the installed version, it flags the package as outdated.
  4. Format Output: It then presents this information in a human-readable table, showing the package name, its current installed version, the latest available version, and the package type (wheel or sdist).

The main lever you control here is simply running the command. Its behavior is largely determined by what’s installed and what’s on PyPI. You don’t configure pip list --outdated itself.

The most surprising thing about pip list --outdated is that it doesn’t automatically know about your project’s specific version constraints. If your requirements.txt or pyproject.toml specifies requests<2.29.0, pip list --outdated will still show requests as outdated if 2.29.0 or later is available on PyPI, even though upgrading would violate your project’s declared constraints. It’s a general "what’s new" tool, not a "what’s compatible with my project" tool.

If you want to act on this information, you’d typically run pip install --upgrade <package_name> or, more commonly, update your requirements.txt and then run pip install -r requirements.txt.

The next step after identifying outdated packages is often deciding whether to upgrade them, which involves understanding dependency conflicts.

Want structured learning?

Take the full Pip course →