Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pygraphviz OSError: Format: "dot" not recognized. Use one of:

I want to plot the tree generated by DEAP using pygraphviz. I tried to follow the example in this DEAP document, but got the following error:

Traceback (most recent call last):
  File "<input>", line 24, in <module>
  File "C:\Users\xxyao\program\anaconda\envs\rf\lib\site-packages\pygraphviz\agraph.py", line 1399, in layout
    data = self._run_prog(prog, ' '.join([args, "-T", fmt]))
  File "C:\Users\xxyao\program\anaconda\envs\rf\lib\site-packages\pygraphviz\agraph.py", line 1364, in _run_prog
    raise IOError(b"".join(errors).decode(self.encoding))
OSError: Format: "dot" not recognized. Use one of:

It seems like should be some words after the Use one of: but there is not. My environment is Python==3.6,graphviz==3.41,pygraphviz==1.5.The graphvizand pygraphviz are installed via conda.

By the way, I tried the following method:

  1. install graphviz and add C:\Program Files (x86)\Graphviz2.38\bin to system environment.
  2. conda install pydot, conda install pydot-ng

but it still doesn't work.

Further infomation: Other layout provided by pygraphviz such as neato fdp twopi works well. Only the dot doesn't work!

like image 306
xxyao Avatar asked Dec 11 '22 02:12

xxyao


1 Answers

I had the same problem. And solved it by executed "dot -c" in conda cmd.

like image 76
Huang Qiang Avatar answered Jan 08 '23 06:01

Huang Qiang