Environment:Pyro ppl Pyro Visualization Tools
| Knowledge Sources | |
|---|---|
| Domains | Infrastructure, Visualization |
| Last Updated | 2026-02-09 09:00 GMT |
Overview
Optional visualization environment providing graphviz for model graph rendering and matplotlib/seaborn for plotting inference results.
Description
This environment provides the optional visualization tools used by Pyro for model inspection and result plotting. The most notable tool is graphviz, which is required by `pyro.infer.inspect.render_model()` and `pyro.util.save_visualization()` to render model dependency graphs. Additional plotting libraries (matplotlib, seaborn, visdom) support tutorial examples and result visualization.
Usage
Use this environment when rendering model graphs via `pyro.render_model()`, running tutorial notebooks, or plotting inference results (loss curves, posterior distributions, predictive checks).
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Linux or macOS | Graphviz system binary may be needed |
| System | graphviz binary | Some systems need `apt install graphviz` in addition to the Python package |
Dependencies
System Packages
- `graphviz` system binary (for rendering; the Python package is a binding)
Python Packages
- `graphviz` >= 0.8
- `matplotlib` >= 1.3
- `seaborn` >= 0.11.0
- `visdom` >= 0.1.4, < 0.2.2
- `pillow` >= 8.3.1
- `pandas`
- `notebook`
- `ipywidgets`
Credentials
No credentials required for local visualization. Visdom requires a running Visdom server.
Quick Install
# Install Pyro with all extras (includes visualization)
pip install pyro-ppl[extras]
# Or install visualization packages individually
pip install graphviz>=0.8 matplotlib>=1.3 seaborn>=0.11.0
# On Ubuntu/Debian, also install the graphviz system binary
# apt install graphviz
Code Evidence
Graphviz import with helpful error from `pyro/infer/inspect.py:505-513`:
try:
import graphviz # noqa: F401
except ImportError as e:
raise ImportError(
"Looks like you want to use graphviz (https://graphviz.org/) "
"to render your model. "
"You need to install `graphviz` to be able to use this feature. "
"It can be installed with `pip install graphviz`."
) from e
Graphviz fallback for type hints from `pyro/infer/inspect.py:20-23`:
try:
import graphviz
except ImportError:
graphviz = SimpleNamespace(Digraph=object) # for type hints
Visdom version constraint from `setup.py:73`:
"visdom>=0.1.4,<0.2.2", # FIXME visdom.utils is unavailable >=0.2.2
Pillow version constraint from `setup.py:75`:
"pillow>=8.3.1", # https://github.com/pytorch/pytorch/issues/61125
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `ImportError: You need to install graphviz` | graphviz Python package missing | `pip install graphviz` |
| `ExecutableNotFound: failed to execute 'dot'` | graphviz system binary missing | Install system graphviz (e.g., `apt install graphviz`) |
| `ImportError: visdom.utils` unavailable | visdom >= 0.2.2 installed | Downgrade: `pip install "visdom>=0.1.4,<0.2.2"` |
Compatibility Notes
- Graphviz dual install: Both the Python package (`pip install graphviz`) and the system binary (`apt install graphviz`) are needed for rendering
- Visdom upper bound: visdom >= 0.2.2 breaks due to missing `visdom.utils` module
- Pillow: Version >= 8.3.1 required to fix PyTorch issue #61125