Python
easy_install
pip
package management
installed packages

Find all packages installed with easy_install/pip?

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

Introduction

If you want to list installed Python packages, the modern answer is almost always pip, not easy_install. The real challenge is usually not the command itself. It is making sure you are querying the correct Python environment.

That matters because the same machine may have multiple interpreters, multiple virtual environments, and sometimes both pip-managed and conda-managed packages. A package list is only meaningful if it belongs to the interpreter your application actually uses.

Start With the Interpreter, Not Just pip

The safest pattern is to run pip through the interpreter directly:

bash
python -m pip --version
python -m pip list

This is better than calling plain pip because it removes ambiguity about which Python executable owns that package set.

If you have multiple Python versions installed, the difference is important. pip on your PATH may not be the same environment as the python command you use to run your app.

Use pip list for a Human-Readable Inventory

When the goal is simple inspection, use:

bash
python -m pip list

That gives a readable table of package names and versions. If another tool needs to parse the results, JSON output is available:

bash
python -m pip list --format json

This is useful in diagnostics, scripts, and CI environments where you want structured output rather than a formatted table.

Use pip freeze for Reproducible Snapshots

If you want a pinned list that can be reused later, pip freeze is more appropriate:

bash
python -m pip freeze

Or write it to a file:

bash
python -m pip freeze > requirements.txt

The mental model is:

  • 'pip list for humans'
  • 'pip freeze for environment snapshots'

Do not confuse the two. They serve related but different purposes.

What About easy_install?

easy_install is legacy tooling from the older setuptools era. You may still encounter environments that were originally touched by it, but it is not the normal package-management interface in modern Python workflows.

If you suspect an older environment contains packages from mixed installation history, inspect the installed distributions directly rather than relying on easy_install itself:

python
1import importlib.metadata
2
3for dist in sorted(importlib.metadata.distributions(), key=lambda d: d.metadata["Name"].lower()):
4    print(f"{dist.metadata['Name']}=={dist.version}")

That reads the installed distribution metadata from the active environment and is often a more reliable audit mechanism than historical tooling names.

Check Virtual Environments Explicitly

Before trusting any package list, confirm the environment:

bash
which python
python -V
python -m pip --version

In a virtual environment, those paths should point inside the virtual environment directory. If they do not, you may be listing global packages while debugging a local venv problem, or vice versa.

For conda-based environments, you may need both:

bash
conda list
python -m pip list

That is because conda and pip can both contribute packages to the same environment.

Programmatic Reporting Inside Python

Sometimes you want the package inventory from inside a running process, not from a shell. importlib.metadata works well for that too:

python
1import importlib.metadata
2import sys
3
4print(sys.version)
5
6for dist in importlib.metadata.distributions():
7    print(dist.metadata["Name"], dist.version)

This is useful for support bundles, internal diagnostics, and environment-reporting endpoints.

Common Pitfalls

The most common mistake is querying the wrong interpreter. A package may appear to be "missing" simply because pip list was run against a different Python installation.

Another common issue is treating easy_install as a current first-class workflow. In modern Python, it is mostly historical context rather than the right tool for package inspection.

Developers also confuse pip list and pip freeze. One is a readable inventory, while the other is closer to a reproducible snapshot.

Finally, hybrid environments can mislead you. If conda and pip both manage packages, one command may not tell the whole story.

Summary

  • Use python -m pip list to inspect installed packages in the active Python environment.
  • Use python -m pip freeze when you want a pinned snapshot for reproducibility.
  • Treat easy_install as legacy and use modern metadata tools for auditing old environments.
  • Always verify which interpreter and environment you are querying.
  • Use importlib.metadata when you need package inventories from inside Python itself.

Course illustration
Course illustration

All Rights Reserved.