Skip to content

[Solved] graphviz.backend.ExecutableNotFound: failed to execute ['dot', '-Tpdf', '-O', 'Digraph.gv'], make sure the Graphviz executables are on your systems' PATH

Today, I used PyTorch to build a model, I suddenly needed to submit my technical report, so I simply found a tool to visualize the model: torchviz.

I have used this tool before, but it took a lot of effort on other servers to set it up. Sure enough, on the brand new server, I immediately reported the following error as soon as I used it:

graphviz.backend.ExecutableNotFound: failed to execute ['dot', '-Tpdf', '-O', 'Digraph.gv'], make sure the Graphviz executables are on your systems' PATH

Although I didn't carefully study where the problem was, I saw the keyword "Graphviz" and I knew roughly what to do: either install Graphviz or add it to environment variables.


Windows

If Graphviz is not installed in the system, you can go to the following website to install: https://graphviz.gitlab.io/_pages/Download/Download_windows.html

After the installation is complete, add the full path of the "bin" folder under the "Graphviz2.38" installation path to the environment variable, and it can usually be read normally.


Linux

Linux is even simpler. If Graphviz has not been installed, use the following instructions to install it:

sudo apt-get update
sudo apt-get install graphviz

Mac

The installation of the Mac version is similar to that of Linux. Use the following command to install normally:

brew install graphviz

References

Leave a Reply