DEV Community

Flávia Bastos
Flávia Bastos

Posted on • Originally published at flaviabastos.ca on

TIL: installed packages in Python – list, and show

If your Python project has a very short list of required packages (in requirements, pipfile, etc), it’s easy to see all packages you have. But on large projects, the dependencies can run pretty long, not to mention the dependencies for the required packages. And what about learning more about those dependencies?

pip list

Will list all installed packages

pip show <package_name>

Will show information about installed packages and if you’re lucky, what other package requires that dependency

And, of course, pip -h will show all other pip options.

Example:

requirements.txt

Django>=3.1.0,<3.2.0
djangorestframework>=3.12.2,<3.13.0
psycopg2>=2.8.6,<2.9.0
Pillow>=8.1.0,<8.2.0

flake8>=3.8.4,<3.9.0

Enter fullscreen mode Exit fullscreen mode

List my packages:

# pip list
Package Version
------------------- -------
asgiref 3.3.1
Django 3.1.7
djangorestframework 3.12.2
flake8 3.8.4
mccabe 0.6.1
Pillow 8.1.0
pip 21.0.1
psycopg2 2.8.6
pycodestyle 2.6.0
pyflakes 2.2.0
pytz 2021.1
setuptools 53.0.0
sqlparse 0.4.1
wheel 0.36.2
Enter fullscreen mode Exit fullscreen mode

Show more about one package:

# pip show pyflakes
Name: pyflakes
Version: 2.2.0
Summary: passive checker of Python programs
Home-page: https://github.com/PyCQA/pyflakes
Author: A lot of people
Author-email: code-quality@python.org
License: MIT
Location: /usr/local/lib/python3.9/site-packages
Requires: 
Required-by: flake8
Enter fullscreen mode Exit fullscreen mode

If you found this helpful, please share this article!

List installed packages in Python

Tweet

The post TIL: installed packages in Python – list, and show _was originally published at _flaviabastos.ca

Top comments (0)