Install#
PyGraphviz provides wheels for most common platforms and can be installed
with pip:
pip install pygraphviz
Note
Prior to version 2.0, pygraphviz requires
Graphviz (version 2.46 or later) to be installed
on the system.
or other popular management systems such as conda:
conda install --channel conda-forge pygraphviz
Warning
Do not use the default channels to install pygraphviz with conda. The
conda-forge channel should be used instead:
conda install --channel conda-forge pygraphviz
Install from Source#
Building PyGraphviz from source requires:
Python (version 3.10, 3.11, 3.12, 3.13 or 3.14)
Graphviz (version 2.46 or later)
C/C++ compiler
See the Graphviz installation docs for information on how to install graphviz on your platform. You can verify that graphviz is installed correctly with:
dot -V
Then, from the source directory:
pip install . --verbose
This will work out-of-the-box if the graphviz headers and libraries are on the
default discovery paths for your system.
If not, you will have to provide the header and library locations using the
--global-option flag, for example:
pip install --config-settings="--global-option=build_ext" \
--config-settings="--global-option=-I<graphviz_install>/include/" \
--config-settings="--global-option=-L<graphviz_include/lib" \
.
Where <graphviz_install> is the location where graphviz was installed on
your system.