I’m having issues getting python graphviz to find ‘dot’ in the PATH environment variable. This seems to be a well-documented problem, but I still can’t seem to get past it.
I have added graphviz to the PATH and restarted my IDE and computer afterwards. I can verify that I did this right because I can call ‘dot’ from the command line. However, graphviz still cannot find ‘dot’ for some reason. I have also uninstalled and reinstalled graphviz which didn’t work. I am using version 0.20.1.
Any ideas as to what is going wrong? Any help is much appreciated.
Here is an example code and full stack trace of the error:
import graphviz
g = graphviz.Digraph('G', filename='hello.gv')
g.edge('Hello', 'World')
g.view()
Traceback (most recent call last):
File "C:Users.python_envlibrarysite-packagesgraphvizbackendexecute.py", line 81, in run_check
proc = subprocess.run(cmd, **kwargs)
File "C:Program FilesPython37libsubprocess.py", line 488, in run
with Popen(*popenargs, **kwargs) as process:
File "C:Program FilesPython37libsubprocess.py", line 800, in __init__
restore_signals, start_new_session)
File "C:Program FilesPython37libsubprocess.py", line 1207, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:Users graphviz_test.py", line 7, in <module>
g.view()
File "C:Users.python_envlibrarysite-packagesgraphviz_tools.py", line 171, in wrapper
return func(*args, **kwargs)
File "C:Users.python_envlibrarysite-packagesgraphvizrendering.py", line 186, in view
cleanup=cleanup, quiet=quiet, quiet_view=quiet_view)
File "C:Users.python_envlibrarysite-packagesgraphviz_tools.py", line 171, in wrapper
return func(*args, **kwargs)
File "C:Users.python_envlibrarysite-packagesgraphvizrendering.py", line 122, in render
rendered = self._render(*args, **kwargs)
File "C:Users.python_envlibrarysite-packagesgraphviz_tools.py", line 171, in wrapper
return func(*args, **kwargs)
File "C:Users.python_envlibrarysite-packagesgraphvizbackendrendering.py", line 327, in render
capture_output=True)
File "C:Users.python_envlibrarysite-packagesgraphvizbackendexecute.py", line 84, in run_check
raise ExecutableNotFound(cmd) from e
graphviz.backend.execute.ExecutableNotFound: failed to execute 'dot', make sure the Graphviz executables are on your systems' PATH
Curtis Wang is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
14
Here is where the “real” Graphviz system lives: https://graphviz.org/download/
3