windowspython-3.xkerasgraphvizpydot

keras plot_model tells me to install pydot


I'm using python 3.6.3 on a windows 10 machine. I installed pydot and graphviz using pip install via:

    py -m pip install pydot
    py -m pip install graphviz

I also went to the graphviz website and downloaded and installed the windows version here: http://www.graphviz.org/Download_windows.php which default installed to program files(x86). But when I go to plot my model in keras, I still get the error saying I have to install pydot and graphviz and that the import failed. I can do

    import pydot
    import graphviz

on my python console just fine, they throw no errors. What else should I do to be able to graph my neural net?


Solution

  • The path(s) to the installed GraphViz executables (dot, neato, etc.) need to be in the PATH environment variable, in order for pydot to find them. pydot used to search for those executables in earlier versions, but not any more.

    Also:

    1. pydot is a Python package.
    2. GraphViz is a collection of tools written in C for computing graph layouts
    3. graphviz is a Python package entirely unrelated to pydot. These two Python packages do not interact in any way with each other. Installing one of them should suffice (together with GraphViz).

    See also:

    and links from there.