*******
Install
*******

PyGraphviz provides `wheels`_ for most common platforms and can be installed
with ``pip``::

    pip install pygraphviz

.. _wheels: https://pypi.org/project/pygraphviz/#files

.. note::

   Prior to version 2.0, ``pygraphviz`` requires
   `Graphviz <https://www.graphviz.org/>`_ (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

   - |conda-forge-ubuntu-badge|
   - |conda-forge-macos-badge|
   - |conda-forge-windows-badge|


.. |conda-forge-ubuntu-badge| image:: https://github.com/pygraphviz/pygraphviz/workflows/conda-forge-ubuntu/badge.svg
.. |conda-forge-macos-badge| image:: https://github.com/pygraphviz/pygraphviz/workflows/conda-forge-macos/badge.svg
.. |conda-forge-windows-badge| image:: https://github.com/pygraphviz/pygraphviz/workflows/conda-forge-windows/badge.svg

Install from Source
-------------------

Building PyGraphviz from source requires:

- Python (version 3.11, 3.12, 3.13 or 3.14)
- `Graphviz <https://www.graphviz.org/>`_ (version 2.46 or later)
- C/C++ compiler

See the `Graphviz installation docs <https://graphviz.org/download/>`_ 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.
