I am trying to use Graphviz to output a sklearn decision tree diagram, but even though I’ve installed Graphviz through both python and download from the internet and set the path correctly, it still returns the following error:
Traceback (most recent call last): File "C:\Users\user\Documents\program\program\program\program.py", line 187, in <module> dec_tree_graph.render(filename="C:\\Users\\user\\Documents\\program\\decision_tree.png", format="png", view = True) File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\graphviz\files.py", line 209, in render quiet=quiet) File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\graphviz\backend.py", line 221, in render run(cmd, capture_output=True, cwd=cwd, check=True, quiet=quiet) File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\graphviz\backend.py", line 167, in run raise ExecutableNotFound(cmd) graphviz.backend.ExecutableNotFound: failed to execute ['dot', '-Tpng', '-O', 'decision_tree.png'], make sure the Graphviz executables are on your systems' PATH
I am using Visual Studio 2017 on Windows 10, and the Graphviz installer has put the
bin folder in
C:\Program Files\Graphviz 2.44.1 . That is exactly the file path I gave to PATH, as well as
C:\Program Files\Graphviz 2.44.1\bin and
C:\Program Files\Graphviz 2.44.1\bin\dot.exe . I’ve restarted Visual Studio and my machine. How can I get the system to recognize Graphviz?