Main Street Docs

List Package Versions pip: Complete Guide

Updated November 9, 2026

Blank template:PDFWord

List Package Versions pip: Complete Guide

To list installed package versions with pip, run pip list in your terminal. This displays all installed packages and their versions in a simple table. For more detailed information, including the location of each package, use pip list -v (verbose mode).

Why You Need to List Package Versions

Knowing exactly which versions of Python packages are installed is crucial for several reasons:

  • Reproducibility: Sharing your environment with others becomes reliable when you pin exact versions.
  • Debugging: A bug may only appear in a specific version; knowing your version helps isolate the issue.
  • Security: Outdated packages may have known vulnerabilities. Listing versions lets you check against security advisories.
  • Compatibility: Some packages require specific versions of other packages. Listing helps verify compatibility.

Basic Commands to List Installed Packages

The most straightforward command is pip list. It outputs a table with two columns: Package and Version. For example:

Package    Version
---------- -------
beautifulsoup4 4.12.2
requests   2.31.0

To see more details, use pip list -v (verbose). This adds the location of each package and the installer (e.g., pip, conda). This is useful when you have multiple Python environments and want to confirm which one you are inspecting.

Filtering and Searching the List

When you have many packages, filtering helps. Use pip list --outdated to see packages that have newer versions available. This is a quick way to identify what needs updating.

To search for a specific package, you can combine pip list with grep (on Unix-like systems) or findstr (on Windows). For example:

pip list | grep requests

This will show only lines containing “requests”. Alternatively, you can use pip show requests to get detailed information about a single package, including its version, location, and dependencies.

Listing Versions of a Specific Package

If you only need the version of one package, pip show package_name is the best choice. It displays a block of information, including the Version field. For example:

pip show requests

This outputs something like:

Name: requests
Version: 2.31.0
Summary: Python HTTP for Humans.
Home-page: https://requests.readthedocs.io
...

You can also use pip list | grep package_name as a quicker one-liner.

Understanding Version Numbering

Python packages follow PEP 440 versioning. Versions consist of a major, minor, and patch number (e.g., 2.31.0). Sometimes there are pre-release suffixes like rc1 or dev. Understanding this helps you interpret the list correctly.

When you see a version like 2.31.0, the major version is 2, minor is 31, and patch is 0. Changes in major version may break backward compatibility, while minor and patch updates are usually backward-compatible.

Common Problems and Solutions

Here are a few issues you might encounter when listing package versions:

  • pip not found: If you get “pip: command not found”, try python -m pip instead. This ensures you are using the pip associated with your current Python interpreter.
  • Multiple Python versions: If you have multiple Python installations, each has its own pip. Use python3 -m pip list to target a specific interpreter.
  • Permission denied: On some systems, you may need to use sudo (Linux/macOS) or run as Administrator (Windows) to access the global package list. However, using a virtual environment avoids this issue.

Using pip freeze for Requirements Files

While pip list shows all installed packages, pip freeze outputs them in a format suitable for a requirements file. This is essential for replicating an environment. The output looks like:

beautifulsoup4==4.12.2
requests==2.31.0

You can save this to a file using:

pip freeze > requirements.txt

Then, on a new machine, you can install the same versions with pip install -r requirements.txt. Note that pip freeze includes all packages, not just the ones you explicitly installed, so it can be verbose.

Comparing pip list and pip freeze

Both commands list installed packages, but they serve different purposes. pip list is human-readable, with columns and optional verbose details. pip freeze is machine-readable, using the == format that pip install expects. Use pip list for quick inspection and pip freeze for generating requirements files.

Frequently Asked Questions

How do I list all outdated packages?

Run pip list --outdated. This shows packages with a newer version available, along with the current and latest versions. It’s a handy way to see what needs updating.

Why does pip list show packages I didn’t install?

pip list shows all packages in the current environment, including dependencies of packages you installed. For example, installing requests also installs urllib3 and certifi. This is normal and expected.

How can I see the version of a package without installing it?

You can use pip index versions package_name (available in newer pip versions) to see all available versions on PyPI. This does not install anything, just queries the index.

What does the asterisk (*) mean in pip list output?

In older pip versions, an asterisk next to a version indicated that the package was installed in editable mode (pip install -e). This is less common now; use pip list -v to see the location and detect editable installs.

Can I list packages in a virtual environment?

Yes. Activate the virtual environment first (e.g., source venv/bin/activate on Linux/macOS, or venv\Scripts\activate on Windows), then run pip list. It will show only the packages in that environment.

Package Version List Template

Below is a blank template for recording your package versions. Fill in the package name and version as you check them.

Package Name Version Date Checked
________________ ________________ ________________
________________ ________________ ________________
________________ ________________ ________________
________________ ________________ ________________

Sample (fictional):

Package Name Version Date Checked
flask 3.0.2 2025-04-10
requests 2.31.0 2025-04-10
numpy 1.26.4 2025-04-10

Safety and Best Practices

When working with package versions, always consider the following:

  • Use virtual environments: This isolates your project’s dependencies and prevents conflicts with system-wide packages.
  • Pin versions in requirements.txt: Use pip freeze to create a snapshot of your environment. This ensures stability.
  • Check for security updates: Regularly run pip list --outdated and review security advisories for your packages.
  • Do not use sudo with pip unnecessarily: Installing globally with sudo can overwrite system packages. Prefer a virtual environment.

If you are unsure about a package’s license or security, consult the official documentation or a qualified professional.

Related