genclik27
genclik27

Reputation: 323

pygraphviz ValueError: Program dot not found in path (python)

I am having problem with pygraphviz on win7(64). I installed Graphviz and then pygraphviz. When I try to compile my code

G=pgv.AGraph()
d={'1': {'2': None}, '2': {'1': None, '3': None}, '3': {'2': None}}
A=pgv.AGraph(d)
G.add_node(1, color='red')
G.add_edge('b','c',color='blue')
G.layout(prog='dot') 
G.draw('file.png')

I get this error

pydev debugger: starting
Traceback (most recent call last):
  File "D:\Program Files\Eclipse\plugins\org.python.pydev_3.3.3.201401272249\pysrc\pydevd.py", line 1738, in <module>
    debugger.run(setup['file'], None, None)
  File "D:\Program Files\Eclipse\plugins\org.python.pydev_3.3.3.201401272249\pysrc\pydevd.py", line 1355, in run
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "D:\Users\SUUSER\workspace\ThreadGraph\parseText.py", line 17, in <module>
    G.layout(prog='dot') 
  File "C:\Python27\lib\site-packages\pygraphviz\agraph.py", line 1305, in layout
    data=self._run_prog(prog,' '.join([args,"-T",fmt]))
  File "C:\Python27\lib\site-packages\pygraphviz\agraph.py", line 1251, in _run_prog
    runprog=r'"%s"'%self._get_prog(prog)
  File "C:\Python27\lib\site-packages\pygraphviz\agraph.py", line 1239, in _get_prog
    raise ValueError("Program %s not found in path."%prog)
ValueError: Program dot not found in path.

Dont tell me it is a duplicate. I looked all answers.

pygraphviz ValueError: Program dot not found in path

(Python) ValueError: Program dot not found in path

PyGraphViz agraph.layout() throws I0 error

Upvotes: 1

Views: 8210

Answers (2)

Anon
Anon

Reputation: 629

If you have Anaconda installed the simplest way to go about this is run the following from CMD:

conda install graphviz

you might also need the following:

conda install pydot-ng

Upvotes: 1

Lee
Lee

Reputation: 31040

You may get this problem even if you have PyGraphviz installed, if the PyGraphviz bin directory has not been added to the path. I had this problem on windows (after installing PyGraphviz with .msi).

To resolve, add the bin directory (e.g. C:\Program Files (x86)\Graphviz2.38\bin) to the PATH system variable, e.g. on Win7:

System Properties -> Environment Variables -> System Varibales -> PATH -> Edit...

Upvotes: 1

Related Questions