Fixing Graphviz RuntimeError: Make sure the Graphviz executables are on your system’s path

Graphviz RuntimeError: Make sure the Graphviz executables are on your system’s path is an error which occurs because your Graphviz installation is faulty or because you have not correctly added Graphviz to your environment variables.

I will explain why this error takes place and how to fix it, while also trying to add other solutions that could solve the error.

Exploring Graphviz RuntimeError: Make sure the Graphviz executables are on your system’s path

This is an error which occurs because your Graphviz installation is faulty or because you have not correctly added Graphviz to your environment variables.

You should avoid mixing between different errors. The error message should look like the error message bellow.

Make sure the Graphviz executables are on your system’s path-problem-banner

Bellow is a number of tested solutions that I have tried and worked for me.

Solution 1 : correctly install graphviz on your system

The first solution is to go to the download section of the official graphviz website https://graphviz.org/download/

Download and install the package. And Now edit your environment variables.

On windows, type “environment variables” in the search bar at the bottom. Click on the icon which pops up and find “System Path”

Add the directory bellow to the variable.

                                                                       #
# replace v.vv  in Graphvizv.vv  with the version of graphviz
C:\Program Files (x86)\Graphvizv.vv\bin\dot.exe 
                                                                       #

Find “User path” and add the directory bellow to the variable.

                                                                       #
# replace v.vv  in Graphvizv.vv  with the version of graphviz
C:\Program Files (x86)\Graphvizv.vv\bin 
                                                                       #

Bellow we have an other solution that might help you if this one failed.

Solution 2 : other ways to correctly install graphviz on your system and/or configure the bin file

The second solution is to get graphviz to work on your system and not just use pip to install it on python

On Mac you can use brew to install graphviz

                                                                       #
# On Mac you can use brew to install graphviz
brew install graphviz
                                                                       #

You can use sudo for root privileges for Linux distrbutions.

                                                                       #
# use sudo for root privileges for Linux distrbutions.
sudo apt-get install graphviz
                                                                       #

Another thing that might fix your problem is adding

                                                                       #

import os
# adding this might fix your problem
os.environ["PATH"] += os.pathsep + <location of the bin file>
                                                                       #

Where <location of the bin file>can be similar to the one bellow

                                                                       #
# Replace v.vv in Graphvizv.vv/bin/  with your Graphviz version
C:/Program Files (x86)/Graphvizv.vv/bin/  
                                                                       #

The solutions above should be enough to solve the problem, if you like our effort make sure to consider donating to our Kofi account, there is a red button that you can use if you are feeling generous.

Summing-up

I hope you found a solution to Make sure the Graphviz executables are on your system’s path in our article, keep creating and keep coding, cheers. If you want to learn more about Python, please check out the Python Documentation : https://docs.python.org/3/