Skip to content

/commands/pip/pip-show-package-version

pip show package: check the installed version of a Python package

verified onenvironmentlocal · windows 10.0.26200 arm64 · GNU bash 5.3.15 (Git Bash) · pip 26.2.2 fromupdated
tool
pip
versions
pip 20+
os
any

pip show requests prints the installed version of a package together with its summary, license, install location, the packages it requires and the installed packages that require it. When the package is not installed it prints WARNING: Package(s) not found and exits with code 1. Run it as python -m pip show to be sure you query the same Python that runs your code.

Show one package

bash
uv run -q --no-project --python 3.13 --with pip==25.2 --with requests==2.32.3 \
  python -m pip show --disable-pip-version-check requests | grep -E "^(Name|Version|Requires|Required-by):"

Output

Name: requests
Version: 2.32.3
Requires: certifi, charset-normalizer, idna, urllib3
Required-by:

The example creates a throwaway environment with uv that contains pip and requests; in your own environment the command is pip show requests. Requires lists the direct dependencies of requests, and Required-by is empty because nothing else installed depends on it. The full output also has Location, the site-packages folder the package lives in, which tells you which environment you looked at.

Missing package and exit code

bash
uv run -q --no-project --python 3.13 --with pip==25.2 \
  python -m pip show --disable-pip-version-check nosuchpackage

Output · exit 1

WARNING: Package(s) not found: nosuchpackage

Because the exit code is 1, pip show pkg > /dev/null 2>&1 || pip install pkg is a simple "install if missing" check in shell scripts.

Other ways to get the version

CommandWhat it prints
pip show requestsVersion, location, Requires and Required-by
pip show -f requestsAlso every file the package installed
pip show requests flaskSeveral packages, separated by ---
pip listEvery installed package with its version, as a table
pip freeze | grep -i requestsThe name==version line (findstr /i on Windows cmd)
python -c "import importlib.metadata as m; print(m.version('requests'))"Only the version, from inside Python
pip index versions requestsVersions available on the index (experimental command)

Pitfalls

  • Several Pythons. pip on PATH may belong to another interpreter than python. Compare pip --version (it prints the Python it belongs to) with python --version, or always use python -m pip.
  • Distribution name vs import name. pip show takes the name you install (pyyaml, scikit-learn, pillow), not the module you import (yaml, sklearn, PIL). Names are case-insensitive, and -, _ and . are treated alike.
  • Installed but not importable. If pip show finds the package but import fails with ModuleNotFoundError, the code runs with a different interpreter or virtual environment.

How to confirm it worked

Version: is the version Python will import from that environment. Cross-check with the importlib.metadata one-liner above using the interpreter that runs your application; both must print the same number.

FAQ

pip show says the package is not found, but import works. Why?

The pip you ran belongs to a different Python than the one that runs your code. Use python -m pip show package with the same python you use to run the program, and the answer will match.

How do I check a version from inside Python?

Use importlib.metadata.version('requests'), available since Python 3.8. Many packages also have a __version__ attribute, but not all, and it is not guaranteed to match the installed metadata.

How do I see which versions of a package exist on PyPI?

pip index versions requests lists the versions available on the index (the command is marked experimental in pip's documentation).

Sources