CLI tool
tox-dev/pipdeptree avatar
tox-dev/pipdeptree

pipdeptree 4.2: A Rust-Powered Dependency Tree Inspector for Python Environments

A command line utility to display dependency tree of the installed Python packages.

3,022 stars161 forksRustMIT

At a glance

What is it?
pipdeptree turns the flat output of pip freeze into a parent-child dependency tree, adds conflict and cycle reporting, and now offers offline lock file inspection. This review covers what it does, how it works, and where it falls short.
Who is it for?
Adopt pipdeptree if you manage Python environments and need a quick, readable view of dependency relationships, especially for conflict or cycle detection before a deployment. Skip it if you require deep dependency resolution beyond simple reverse lookups, or if you expect it to replace a full lock file manager.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository received new commits within the last day.
What is it written in?
Mainly Rust, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 15, 2026, and from our analysis. They are not legal advice.

DEEP OPEN-SOURCE ANALYSIS

What pipdeptree Solves for Python Environment Auditors

Python's pip freeze produces a flat list of installed packages. That list tells you what is present, but not why. pipdeptree adds the missing parent-child relationships. It shows which package requires which, and it flags two common problems: dependency conflicts, where an installed version does not satisfy the requirement, and cycles, where packages depend on each other in a loop. The tool targets developers and release engineers who need to understand an environment's dependency graph before shipping. It is not a resolver. It does not install or upgrade anything. It reads what is already installed and presents it in a structured way. The README shows a sample tree with checkmarks and warning symbols, so you can see at a glance which dependencies are satisfied and which are not. For anyone who has stared at a long pip freeze output and wondered which package pulled in a specific transitive dependency, this tool answers that question directly.

How the Tree Is Built: From Installed Metadata to Parent-Child Edges

The core mechanism is straightforward. pipdeptree reads the installed packages' metadata, specifically the Requires-Dist fields that pip records when installing a package. Each package becomes a node. Each requirement becomes an edge from the requiring package to the required package. The tree is then rendered from the top-level packages down. The README's example shows Flask at the root, with its direct dependencies as children, and MarkupSafe nested under Jinja2 as a transitive dependency. The tool also performs a reverse lookup: given a package name, it shows which installed packages depend on it. The --reverse flag with --packages markupsafe would list Flask and Jinja2 as parents. This reverse view is essential for understanding the blast radius of a version change. The tree output includes the required version range and the installed version, so you can see mismatches inline. The conflict and cycle detection is likely a graph traversal that runs after the tree is built, but the README does not detail the algorithm. It simply states that pipdeptree reports these conditions. The output can be text, JSON, Mermaid, or Graphviz, which makes it usable in documentation or automated pipelines.

Getting Started: Installation and Basic Commands

Installation is a single pip command: pip install pipdeptree. After that, running pipdeptree with no arguments prints the dependency tree for the current environment. The README shows the output format: a tree with Unicode box-drawing characters, checkmarks for satisfied dependencies, and warning signs for mismatches. For a quick reverse lookup, use pipdeptree --reverse --packages markupsafe. That prints which installed packages require markupsafe. The output format flags are -o json, -o mermaid, and -o graphviz-svg. The graphviz-svg option writes an SVG file directly, which is convenient for embedding in documentation. The --summary flag produces a summary report with package counts, depth, conflicts, cycles, licenses, and size. The summary can be output as aligned text, a rich table, or JSON. The README shows three variants: --summary, --summary -o rich, and --summary -o json. These commands are all you need for basic environment inspection. There is no configuration file to set up, no daemon to run, and no server component. It is a pure command line utility.

The from-index and from-lock Subcommands: Inspecting Without Installing

Version 4.2 introduces two subcommands that go beyond the installed environment. The from-index subcommand resolves requirements against a package index and produces a tree without installing anything. You can pass a package name directly, as in pipdeptree from-index "flask", or use a requirements file with --requirements requirements.txt. The i alias is shorthand for from-index. The from-lock subcommand reads a resolved PEP 751 lock file, which is a TOML format, and produces a tree offline. The l alias is shorthand for from-lock. The README example is pipdeptree from-lock pylock.toml. Both subcommands accept the same render flags, including --summary. This is a significant addition because it allows you to inspect a dependency tree before you install anything, or to audit a lock file without access to the network. The offline aspect of from-lock is particularly useful in air-gapped environments. However, the README does not specify which package index from-index uses by default, nor does it explain how the lock file format is parsed beyond referencing PEP 751. You will need to consult the full documentation for those details.

Where pipdeptree Is the Wrong Tool: Limits and Failure Modes

pipdeptree is not a dependency resolver. It cannot tell you what versions would satisfy a conflict, nor can it propose a fix. It only reports what is installed and whether the requirements are met. If you need to resolve a conflict, you will still reach for pip or a tool like pip-tools. The from-index subcommand does resolve requirements, but it does so against a package index, which means it needs network access. In an offline environment, from-index will fail unless you have a local index. The from-lock subcommand works offline, but it depends on the lock file being complete and accurate. If the lock file is missing a transitive dependency, the tree will be incomplete. The README does not mention any validation of the lock file's integrity. Another limitation is that pipdeptree reads the installed environment as-is. If you have multiple Python versions or virtual environments, you must run the tool inside each one separately. There is no cross-environment comparison. The tool also does not handle non-Python dependencies, such as system libraries, so the tree is only a partial view of the real deployment. These are not bugs, but they set the boundary of what the tool can do.

A Real Alternative: pip-tools and the Difference in Approach

The closest alternative is pip-tools, which provides pip-compile and pip-sync. pip-tools takes a requirements.in file and resolves it into a pinned requirements.txt with hashes. The key difference is that pip-tools is a resolver: it computes a consistent set of versions that satisfy all constraints. pipdeptree, in contrast, is an inspector. It does not compute anything new; it reads what is already installed and displays the graph. The from-index subcommand does resolve, but it is a secondary feature, not the core purpose. If your workflow is to generate a lock file from a set of loose requirements, pip-tools is the right tool. If your workflow is to audit an existing environment or a lock file for conflicts and cycles, pipdeptree is more direct. The two tools complement each other. pip-tools creates the lock file, and pipdeptree can inspect it with from-lock. The README does not mention pip-tools by name, but the distinction is clear from the feature set. Another alternative is to use pip's own --tree option, which was added in newer pip versions, but pipdeptree offers more output formats and the summary report, which pip does not.

Maintenance, Upgrade Cost, and License Implications

The project lives under the tox-dev GitHub organization, which is known for maintaining Python development tools. The repository is not archived, and the last push was in August 2026, with three releases in the two months prior. Version 4.2.2 is the latest, and the release cadence suggests active maintenance. The primary language is Rust, which is a notable shift from the original Python implementation. This means the binary is likely faster and has a standalone executable, but it also means that contributing to the core requires Rust knowledge, which may be a barrier for Python developers who want to fix a bug. The installation via pip install pipdeptree still works, so end users do not need a Rust toolchain. The license is MIT, which is permissive and allows commercial use with attribution. There are no obvious copyleft obligations. The upgrade cost is low: since it is a command line tool, you can install a new version and run it. The main risk is that output formats might change between major versions, which could break scripts that parse the text output. The JSON output is more stable, but you should pin the version if you rely on a specific format. The documentation is hosted on readthedocs, and the README points to a changelog, so you can review changes before upgrading.

Editorial conclusion

Adopt pipdeptree if you manage Python environments and need a quick, readable view of dependency relationships, especially for conflict or cycle detection before a deployment. Skip it if you require deep dependency resolution beyond simple reverse lookups, or if you expect it to replace a full lock file manager. Before relying on the from-lock subcommand, verify that your PEP 751 lock file is complete and that the tool's resolution matches your package index. The from-index command is useful for inspecting a tree without installing, but it depends on network access and index accuracy. Verify the output format you need (text, JSON, Mermaid, or Graphviz) matches your reporting pipeline, and check the release notes for 4.2.x changes before upgrading from an older version.

Official sources

  1. Official documentation
  2. Official README
  3. Project repository
  4. Release notes
Community notes

Community notes