Skip to main content

Get the dependency tree of your Python virtual environment via Pip.

Project description

Pip Tree

Get the dependency tree of your Python virtual environment via Pip.

Build Status Coverage Status PyPi Licence


There is no simple, native way to get the dependency tree of a Python virtual environment using the Pip package manager for Python. Pip Tree fixes this problem by retrieving every package from your virtual environment and returning a list of JSON objects that include the package name, version installed, date updated, and which packages are required by each package (the tree).


# Install Pip Tree globally
pip3 install pip-tree

# Install Pip Tree into the virtual environment of the project you want to run it on
venv/bin/pip install pip-tree

# Install locally
just install


Virtual Env Usage:

Global Usage:
    pip-tree --path "path/to/my_project/venv/lib/python3.9/site-packages"

    -h, --help            show this help message and exit
    -p PATH, --path PATH  The path to the site-packages directory of a Python virtual environment. If a path is not provided, the virtual environment Pip Tree is run from will be used.

Sample Output

Generating Pip Tree Report...

        "name": "docopt",
        "version": "0.6.2",
        "updated": "2021-05-12",
        "requires": [],
        "required_by": [
        "name": "flake8",
        "version": "3.9.2",
        "updated": "2021-05-12",
        "requires": [
        "required_by": []
        "name": "Flask",
        "version": "2.0.0",
        "updated": "2021-05-12",
        "requires": [
        "required_by": []

Pip Tree report complete! 40 dependencies found for "path/to/my_project/venv/lib/python3.9/site-packages".


In addition to the CLI tool, you can use functions to retrieve the list of packages and their details from a Python virtual environment in your own code:

import pip_tree

path = 'path/to/my_project/venv/lib/python3.9/site-packages'

package_list = pip_tree.get_pip_package_list(path)
for package in package_list:
    package_details = pip_tree.get_package_details(package)


# Get a comprehensive list of development tools
just --list

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pip-tree-3.1.1.tar.gz (5.9 kB view hashes)

Uploaded source

Built Distribution

pip_tree-3.1.1-py3-none-any.whl (7.0 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page