1

I have graphviz 2.38.0-4 installed. This error message is still showing up:

C:\Users\username\AppData\Local\Continuum\Anaconda3\lib\site- packages\pydotplus\graphviz.py in create(self, prog, format)
   1958             if self.progs is None:
   1959                 raise InvocationException(
-> 1960                     'GraphViz\'s executables not found')
   1961 
   1962         if prog not in self.progs:

InvocationException: GraphViz's executables not found

I have tried methods from here: Graphviz's executables are not found (Python 3.4) Still unable to solve the problem.

Community
  • 1
  • 1
Zed Fang
  • 823
  • 2
  • 13
  • 24

1 Answers1

2

I just ran into the same problem. It turns out that 'graphviz' on Anaconda (at least on Windows) is not the same as the graphviz package on PyPI, i.e. it's not the Python wrapper for graphviz, but the Graphviz binaries themselves. Conda installs the binaries in the "Library\bin" folder (e.g., in my case, "C:\Anconda3\Library\bin"). Usually that would be fine as "Library\bin" is on the system path by default. But the anaconda-graphviz package puts the graphviz binaries in their own subdirectory "Library\bin\graphviz" - there's a batch-file, 'dot.bat', in "Library\bin" redirecting calls to "Library\bin\graphviz\dot.exe". So binaries such as 'twopi' are not on the path by default. But at least pydotplus (the only one I tested) expects them to be; alternatively it looks for a "legacy" Graphviz installation in the Windows Registry and, if that fails, in the default installation location (under %PROGRAMFILES%).

So I see two solutions: either you install Graphviz directly from graphviz.com. As I wanted to retain the ability to update 'graphviz' through 'conda', I instead used pydotplus's 'set_graphviz_executables' to overwrite the paths to the executables. But, as far as I understood, this has to be redone for every single graph:

import os

def conda_fix(graph):
        path = os.path.join(sys.base_exec_prefix, "Library", "bin", "graphviz")
        paths = ("dot", "twopi", "neato", "circo", "fdp")
        paths = {p: os.path.join(path, "{}.exe".format(p)) for p in paths}
        graph.set_graphviz_executables(paths)

graph = pydotplus.graph_from_data(data)
conda_fix(graph)
Image(graph.create_png())
ggeorges
  • 21
  • 2