How to list installed Python packages

Listing installed Python packages is useful before upgrading dependencies, removing one package, or comparing environments that behave differently from the same project directory. A quick inventory shows what the current interpreter can already import and which distribution versions are actually present.

The python3 -m pip list command reads the installed distribution metadata for the selected interpreter and prints package names with their recorded versions. Running pip through python3 -m keeps the result attached to one concrete Python executable or virtual environment instead of whichever standalone pip command appears first in PATH.

Results vary between system installs, user-site installs, and virtual environments, so the first check is always interpreter context. On Windows, replace python3 -m pip with py -m pip when the launcher is available; inside a virtual environment created with python3 -m venv –system-site-packages, add –local to hide inherited global packages, and use pip freeze instead of treating a list output as a requirements snapshot.

Steps to list installed Python packages with pip:

  1. Confirm which interpreter and pip installation will answer the package query.
    $ python3 -c "import sys; print(sys.executable)"
    /srv/apps/acme-api/.venv/bin/python
    
    $ python3 -m pip --version
    pip 26.0 from /srv/apps/acme-api/.venv/lib/python3.14/site-packages/pip (python 3.14)

    Using python3 -m pip avoids mixing a different pip executable with the wrong interpreter on hosts that carry more than one Python installation.

  2. List the installed packages in the default table format.
    $ python3 -m pip list
    Package            Version
    ------------------ ---------
    certifi            2026.2.25
    charset-normalizer 3.4.6
    idna               3.11
    markdown-it-py     4.0.0
    mdurl              0.1.2
    pip                26.0
    Pygments           2.19.2
    requests           2.33.0
    rich               14.3.3
    urllib3            2.6.3

    Packages are listed in case-insensitive order, and editable installs add an extra column that shows the project location.

    Use –user to show only user-site packages or --path /target/site-packages to inspect one installation path without changing interpreters.

  3. Add –not-required when only top-level packages are needed instead of every dependency underneath them.
    $ python3 -m pip list --not-required
    Package  Version
    -------- -------
    pip      26.0
    requests 2.33.0
    rich     14.3.3

    –not-required hides distributions that were installed only as dependencies, which makes ownership reviews and smaller cleanup passes easier to scan.

  4. Add –local when a virtual environment inherits global site packages and only environment-specific packages should appear.
    $ python3 -m pip list --local
    Package  Version
    -------- -------
    colorama 0.4.6
    pip      26.0

    –local changes the output only inside a virtual environment with system-site access, such as one created with python3 -m venv –system-site-packages.

  5. Select a machine-readable or requirements-style output when the package inventory needs to be compared or reused elsewhere.
    $ python3 -m pip list --format=json
    [{"name": "certifi", "version": "2026.2.25"}, {"name": "requests", "version": "2.33.0"}, {"name": "rich", "version": "14.3.3"}]
    
    $ python3 -m pip list --format=freeze
    certifi==2026.2.25
    requests==2.33.0
    rich==14.3.3

    The supported pip list formats are columns, json, and freeze. The examples below show representative entries, and current pip releases do not allow –format=freeze together with –outdated.

    Use pip freeze when the next step is writing a requirements snapshot, because it is the purpose-built export command and handles bootstrap packaging tools differently from pip list.