Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Graphviz not running in jupyter notebook python = 3.6?

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

like image 781
yyxtreme Avatar asked Dec 18 '22 04:12

yyxtreme


1 Answers

I have been having a similar issue (different execution - but both have the same errors in Jupyter) and was able to resolve it this way:

First I uninstalled the graphviz package I had originally installed via the Anaconda prompt.

conda remove graphviz

I found in this issue thread to use the below command to install the graphviz package. Appending graphviz with python- downloads the package in lib/site-packages

conda install python-graphviz

I restarted Jupyter Notebook in order to find dot.exe since I couldn't get it to find it in my running notebook after installing the package.

I hope this helps!

like image 132
Stephanie N Avatar answered Dec 30 '22 08:12

Stephanie N