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.
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.