Get Information About Installed Python Package using pip

Get Information About Installed Python Package using pip

The pip package manager is a valuable tool that allows to install, upgrade, and manage Python packages. However, at times, it becomes necessary to obtain detailed information about a specific package we have installed. Whether you need to check the version, view the package description, or explore its dependencies, pip provides a convenient way to retrieve this information. This tutorial shows how to get information about an installed Python package using pip.

The pip show command can be used to retrieve the basic details of an installed package. This includes information such as the package name, version number, description, location where it is installed, dependencies, and other relevant metadata.

For example, the following command retrieves information about numpy package:

pip show numpy
pip3 show numpy

Here's an example output you might see when running the command:

Name: numpy
Version: 1.24.3
Summary: Fundamental package for array computing in Python
Author: Travis E. Oliphant et al.
License: BSD-3-Clause
Location: /home/ubuntu/dev/workspace/python/myproject/venv/lib/python3.10/site-packages
Required-by: contourpy, matplotlib, onnx, opencv-python, pandas, scipy, seaborn, torchvision

The "Requires" section provides information about the dependencies required by the installed package. It lists other packages that need to be installed in your environment for the package in question to work properly.

The "Required-by" section, on the other hand, provides information about other packages in your environment that depend on the currently installed package. It lists other packages that have a dependency on the package you are inspecting.

Leave a Comment

Cancel reply

Your email address will not be published.