Graphviz not running in jupyter notebook python = 3.6?

Viewed 16654

I am trying to run graphviz to view dot file on jupyter notebook in have imported path to dot.exe path.

G:\anaconda3\envs\tensorflowgpu\Library\bin\graphviz G:\anaconda3\envs\tensorflowgpu\Library\bin\graphviz\dot.exe

I am trying to run this code:

with open("tree1.dot") as f:
dot_graph = f.read()
graphviz.Source(dot_graph)

OR

graphviz.Source("tree1.dot") .view() 

It is giving:

failed to execute ['dot', '-Tsvg'], make sure the Graphviz executables are on your systems' PATH

Please tell me any way to fix this or any other way to View dot file on jupyter notebook i am running python 3.6 on jupter notebook

4 Answers

if you code doesn´t work, you can use this.

import graphviz
from IPython.display import display
with open("tree1.dot") as f:
dot_graph = f.read()
display(graphviz.Source(dot_graph))

Reinstall graphviz

conda remove graphviz 
conda install python-graphviz
graphviz.Source(dot_graph).view()

after you will have a small window where you have to choose where you want see your decision tree

the following worked for me (removal in Jupyter via 'conda remove graphviz' didn't work):

go to Anaconda Navigator Console:

-->Environments--> Search for graphviz --> deinstall

-->Environments --> install python-graphviz

Related