Installing Graphviz on Windows

Being able to plot/generate graph-based images (be it networkx, a keras model structure, or what have you) is a very handy utility to have. However, the backend needed to support simple calls to, say keras.utils.plot_model() is nontrivial– at least on Windows.

Getting the Binary sorted out

Basically, the Python libraries used to do this kind of operation are actually wrappers/interfaces around a popular Open Source tool called Graphviz, so merely pip installing your library of choice only gets at the wrapper, not the underlying codebase that’ll do the heavy lifting.

Because we want to install new Python utilities that rely on non-python-file/module backends, it’s most appropriate to leverage Anaconda. The following command will get you need:

conda install graphviz pydot

This will pull down all of the appropriate library code and tuck it under ../user/Anaconda3/, which is already naturally included in your sys.path variable, like so

from IPython.display import Image



Once you’ve got that, you’re home free to do all of the appropriate importing/use to leverage the underlying engines

import graphviz
{'circo', 'dot', 'fdp', 'neato', 'osage', 'patchwork', 'sfdp', 'twopi'}