
Before you debug an import error, upgrade a project or move it to another server, you need to know which Python packages are installed and which versions. pip has three commands for this: pip list, pip show and pip freeze. This guide shows what each one is for, how to check whether a single package is installed, how to find outdated packages, and how to make sure you're looking at the right Python environment.
Quick answer
pip list # all installed packages and versions
pip show requests # details for one package
pip freeze > requirements.txt # save exact versions to a file
pip list --outdated # packages with newer versions available
1. List all installed packages: pip list
pip list
This prints a table of every package in the current environment with its version. Useful options:
| Command | What it shows |
|---|---|
pip list --user | Only packages installed with --user |
pip list --not-required | Top-level packages that nothing else depends on |
pip list --outdated | Packages with a newer version on PyPI |
pip list --uptodate | Packages already at the latest version |
pip list --format=json | Machine-readable output for scripts |
pip list -v | Adds the install location and installer |
2. Check one package in detail: pip show
pip show requests
Output includes Version, Summary, Location (where it's installed), Requires (its dependencies) and Required-by (what depends on it). Add -f to list every file the package installed. You can pass several names: pip show flask jinja2.
3. Check if a package is installed
pip show numpy # prints details, or "Package(s) not found"
pip list | grep -i numpy # Linux/macOS
pip list | findstr /i numpy # Windows
python -c "import numpy; print(numpy.__version__)"
In scripts, pip show is handy because it returns a non-zero exit code when the package is missing:
pip show numpy > /dev/null 2>&1 || pip install numpy
Note that the import name doesn't always match the package name: you install beautifulsoup4 but import bs4, and install pillow but import PIL.
4. Export installed packages: pip freeze
pip freeze > requirements.txt
pip freeze prints packages in name==version format, ready to reinstall elsewhere with pip install -r requirements.txt. Unlike pip list, it leaves out pip's own tools and is meant for files rather than reading. Use pip freeze --exclude-editable to skip packages installed in editable (development) mode.
5. Find outdated packages and update them
pip list --outdated
pip install --upgrade requests
Upgrade one package at a time and test, rather than everything at once; major versions can break your code. After upgrading, run pip check to confirm all dependencies are still compatible.
6. Make sure you're checking the right environment
The most common confusion: pip list shows different packages than your app sees, because there's more than one Python on the system. Check which one you're using:
python -m pip --version # shows pip version and the Python it belongs to
which python # Linux/macOS
where python # Windows
Using python -m pip instead of plain pip guarantees you list the packages of that exact interpreter. For a project in a virtual environment, activate it first:
source venv/bin/activate # Linux/macOS
venv\Scripts\activate # Windows
pip list
On Ubuntu and Debian, packages installed with apt (like python3-requests) also appear in the system-wide pip list, even though apt manages them.
7. Show the dependency tree
pip itself doesn't draw a tree, but the small pipdeptree tool does:
pip install pipdeptree
pipdeptree # full tree
pipdeptree -p flask # only flask and its dependencies
pipdeptree -r -p jinja2 # what depends on jinja2
Frequently asked questions
How do I list all installed pip packages?
Run pip list, or python -m pip list to be sure you're using the right Python.
What's the difference between pip list and pip freeze?
pip list is a readable table of everything installed. pip freeze prints name==version lines for a requirements file.
How do I check the version of an installed package?
Run pip show package-name and look at the Version line.
Why doesn't pip list show a package I just installed?
You probably installed it into a different Python or virtual environment. Compare python -m pip --version in both places and activate the right venv.


