Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"dot.exe" not found in path. Pydot on Python (Windows 7)

Tags:

python

path

pydot

I'm having trouble running Python's pydot on Windows 7.

I installed pydot with: conda install -c rmg pydot=1.2.2

I have graphviz installed under ../Program Files (x86)/Graphviz2.38/

When I run the following script I get an error saying

"dot.exe" not found in path 
import pydot graph = pydot.Dot(graph_type='digraph') node_a = pydot.Node("Node A", style="filled", fillcolor="red") node_b = pydot.Node("Node B", style="filled", fillcolor="green") node_c = pydot.Node("Node C", style="filled", fillcolor="#0000ff") node_d = pydot.Node("Node D", style="filled", fillcolor="#976856") graph.add_node(node_a) graph.add_node(node_b) graph.add_node(node_c) graph.add_node(node_d) graph.add_edge(pydot.Edge(node_a, node_b)) graph.add_edge(pydot.Edge(node_b, node_c)) graph.add_edge(pydot.Edge(node_c, node_d)) graph.add_edge(pydot.Edge(node_d, node_a, label="and back we go again", labelfontcolor="#009933", fontsize="10.0", color="blue")) graph.write_png('example2_graph.png')  Exception: "dot.exe" not found in path. 

I have tried this solution: Permanently adding a file path to sys.path in Python, by adding the my-paths.pth file with a line pointing to ../Graphiv2.38/bin/ where the dot.exe file is located. But I still get the error.

What else can I try?

like image 201
Dubraven Avatar asked Nov 16 '16 12:11

Dubraven


People also ask

How do I add Pydot to path?

Type conda install pydot graphviz in cmd, and then add the executables location directory C:\Anaconda3\pkgs\graphviz-2.38-hfd603c8_2\Library\bin\graphviz to your system path variable. That works! It works!

What is Pydot in Python?

Pydot is a Python library, also written in Python, that "serves as a graphical interface to Graphviz, an open source graph visualization software. GraphViz is written in DOT language, but Pydot provides the ability to parse and dump data, between Python and DOT."[

How do I fix graphviz's executables not found?

0-win64.exe. If you are using Anaconda, then try running the below commands. Add the Graphviz installed location path to the PATH variable. Once the path is added, restart the system.


2 Answers

I followed the instructions given in this blog.

Then I installed graphviz from here and added C:\Program Files (x86)\Graphviz2.38\bin to PATH.

Next I did:

conda install pydot-ng  

And finally in my notebook I added the two lines below.

import os os.environ["PATH"] += os.pathsep + 'C:/Program Files (x86)/Graphviz2.38/bin/' 
like image 55
Ernest S Kirubakaran Avatar answered Sep 17 '22 20:09

Ernest S Kirubakaran


Type conda install pydot graphviz in cmd, and then add the executables location directory C:\Anaconda3\pkgs\graphviz-2.38-hfd603c8_2\Library\bin\graphviz to your system path variable. That works!

like image 23
jmir Avatar answered Sep 18 '22 20:09

jmir