Graphviz's executables are not found (Python 3.4)

I am running Python3.4 on Windows 7. I am trying to use the Python interface for graphviz. This is a script I intend to run:

from graphviz import Digraph
import pydotplus

dot = Digraph(comment='The Round Table')

dot.node('A', 'King Arthur')
dot.node('B', 'Sir Bedevere the Wise')
dot.node('L', 'Sir Lancelot the Brave')
dot.edges(['AB', 'AL'])
dot.edge('B', 'L', constraint='false')

print(dot.source)
dot.render('test-output/round-table.gv', view=True)

I get the following error at runtime:

RuntimeError: failed to execute ['dot', '-Tpdf', '-O', 'test-output/round-table.gv'], make sure the Graphviz executables are on your systems' path

Now I am sure I have properly installed the correct dependencies. I first tried to set the correct environment variables. The graphviz executables are located at C:\Program Files (x86)\Graphviz2.37\bin so I went to the Environment Variables section. There are two sections there: User Variables and System Variables. Under System Variables I clicked on Path and then clicked Edit and added ;C:\Program Files (x86)\Graphviz2.37\bin to the end of the string and saved. This didn't clear the error.

Then, following the answer given here I uninstalled pydot (actually I use pydotplus here) and re-installed it again, but still no success.

I have been trying for hours to fix this and the whole PATH variable thing is just confusing and frustrating.


Solution 1:

I also had this problem on Ubuntu 16.04.

Fixed by running sudo apt-get install graphviz in addition to the pip install I had already performed.

Solution 2:

In my case (Win10, Anaconda3, Jupyter notebook) after "conda install graphviz" I have to add to the PATH: C:\Users\username\Anaconda3\Library\bin\graphviz

To modify PATH goto Control Panel > System and Security > System > Advanced System Settings > Environment Variables > Path > Edit > New

Solution 3:

Because Mac OS has not been mentioned I will add that I had the same problem on OS X Yosemite, the solution I found was to do brew install graphviz

This solved the problem, not sure if I shouldn't have just edited one of the other answers in this list, because they all seem to be the same answer, just install an official package in addition to the Python Library.

Solution 4:

On jupyter(ipython) notebook with anaconda in win10 I solved the problem by conda install graphviz after I had installed graphviz by pip install graphviz

Solution 5:

I solved it installing directly from https://graphviz.gitlab.io/_pages/Download/Download_windows.html and including in windows path:

C:\Program Files (x86)\Graphviz2.38\bin

C:\Program Files (x86)\Graphviz2.38

After I restart windows