How to list all available package versions with 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 see which versions of a package are available on PyPI, the most direct pip command is pip index versions. That gives you the published versions pip can see, which is useful when you need to pin, downgrade, or check compatibility.
Use pip index versions
The basic command is:
That asks pip to query the package index and list known versions for the package. It is useful when:
- a dependency needs a specific version
- you are investigating a regression after an upgrade
- you want to see whether a version mentioned in documentation still exists
Once you find the version you want, install it explicitly:
That keeps the environment deterministic instead of letting pip choose the newest matching release automatically.
Know What the Command Is Telling You
pip index versions shows versions visible from the configured package index. In the common case that means PyPI, but in some environments it may reflect:
- a private package index
- an internal mirror
- an index URL configured through pip settings
So the list is not just "all versions in the universe". It is "all versions available from the index pip is currently using".
That distinction matters in corporate or air-gapped environments where mirrors can lag behind public PyPI.
Handle Older Environments and Fallbacks
If your pip version does not support pip index versions, upgrade pip if appropriate or use a fallback such as querying the package page or API directly.
A simple upgrade looks like:
Then retry:
Using python -m pip is often safer than relying on whichever pip happens to be first on PATH, because it ties pip to a specific interpreter.
For teams managing repeatable environments, the version listing step is usually just reconnaissance. The important follow-up is recording the chosen version in a requirements file, constraints file, or lock file so everyone installs the same thing later.
That is especially important in CI and deployment pipelines, where "latest available" is rarely the safest policy.
It is better to inspect first, choose deliberately, and then pin the result than to discover a breaking change after an automatic install later unexpectedly.
Common Pitfalls
The biggest mistake is forgetting which Python environment pip is attached to. A virtual environment, system interpreter, or build image may each have a different pip configuration.
Another common issue is reading the available versions and assuming every version is compatible with your Python version. Package releases can have interpreter constraints, so "available" does not always mean "installable here".
People also forget private indexes and mirrors. If a version is missing, the issue may be the configured repository rather than the package itself.
Finally, listing versions is only part of dependency management. For reproducible builds, pin the chosen version in requirements.txt or another lock mechanism instead of reinstalling manually every time.
Summary
- Use
pip index versions <package>to list available package versions from the configured index. - Install a chosen version explicitly with
pip install package==version. - Prefer
python -m pipwhen environment selection matters. - Remember that pip shows versions from the index it is configured to use, not necessarily every public release everywhere.
- Check Python-version compatibility before assuming an available package version will install successfully.

