Install & Compatibility
Where this runs
tested against v3.0.6 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.062s · 18.5MB
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 1.6s · import 0.056s · 19MB
16MB installed
● package 16MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
cli.main
✓ from pydeps import cli
Primary programmatic entry point to mimic command-line usage.
externals
✓ from pydeps.pydeps import externals
Used for programmatic extraction of external dependencies.
depgraph.DepGraph
✓ from pydeps.depgraph import DepGraph
For building custom dependency graph analysis.
This quickstart demonstrates how to use pydeps from the command line (via subprocess) to visualize module dependencies. It creates a temporary Python package, runs pydeps on it, and prints the raw dependency list. To generate a visual graph (e.g., SVG), ensure Graphviz is installed and remove the `--nodot --no-output` flags, using `-o filename.svg` instead.
import os
import subprocess
import tempfile
def create_sample_project(path):
os.makedirs(os.path.join(path, 'mypackage'), exist_ok=True)
with open(os.path.join(path, 'mypackage', '__init__.py'), 'w') as f:
f.write('')
with open(os.path.join(path, 'mypackage', 'module_a.py'), 'w') as f:
f.write('import os\nfrom . import module_b\ndef func_a():\n print("Hello from A")')
with open(os.path.join(path, 'mypackage', 'module_b.py'), 'w') as f:
f.write('import sys\ndef func_b():\n print("Hello from B")')
with tempfile.TemporaryDirectory() as tmpdir:
create_sample_project(tmpdir)
current_dir = os.getcwd()
os.chdir(tmpdir)
try:
# Run pydeps as a subprocess to generate the dependency graph
# Output to stdout and catch errors
result = subprocess.run(
['pydeps', 'mypackage', '--nodot', '--no-output', '--show-deps'],
capture_output=True, text=True, check=True
)
print("\n--- pydeps output (dependencies) ---")
print(result.stdout)
# To generate an SVG file, you'd typically run:
# subprocess.run(['pydeps', 'mypackage', '-o', 'mypackage.svg'], check=True)
# print(f"Dependency graph saved to {os.path.join(tmpdir, 'mypackage.svg')}")
except FileNotFoundError:
print("Error: 'pydeps' command not found. Ensure pydeps is installed and in PATH.")
print("Error: 'dot' command (from Graphviz) might also be missing. Install Graphviz.")
except subprocess.CalledProcessError as e:
print(f"Error running pydeps: {e}")
print(f"Stdout: {e.stdout}")
print(f"Stderr: {e.stderr}")
finally:
os.chdir(current_dir)
pydeps --version
Errors
Common errors & fixes
FileNotFoundError: [Errno 2] No such file or directory: 'dot'
The Graphviz `dot` command, essential for rendering graphs, is not found in the system's PATH.
fixInstall Graphviz on your system and ensure its executables are added to your PATH environment variable. Verify by running `dot -V`.
Error running pydeps: ... output format 'svg' needs graphviz, which is not installed or not in the PATH
Similar to the 'dot' error, pydeps cannot find the Graphviz tool to generate the requested output format.
fixInstall Graphviz and ensure the `dot` command is available in your system's PATH. Restart your terminal or IDE if necessary after installation.
TypeError: 'Config' object does not support item assignment (when using --externals)
This specific error might occur in certain configurations or older versions when trying to modify the configuration object in an unsupported way, possibly related to `--externals` processing.
fixEnsure you are using a recent version of pydeps (3.0.2 or newer). If the issue persists, try running without `--externals` or consult the GitHub issues for specific workarounds related to your pydeps version and configuration.
ValueError: bad marshal data (unknown type code)
This error often indicates an issue with compiled Python bytecode files (`.pyc` files) that are corrupted or from an incompatible Python version, which pydeps might be trying to analyze.
fixTry cleaning your Python environment by removing `__pycache__` directories and `.pyc` files (`find . -name '__pycache__' -exec rm -rf {} +; find . -name '*.pyc' -delete`) and then re-running pydeps. Upgrade
Version history
3.0.6latest on PyPI · released Apr 23, 2026
Audit
Dependencies
GraphvizrequiredRequired for rendering the dependency graphs (e.g., to SVG/PNG). The `dot` command must be available in your system's PATH.