No graphic executables found (Python 3.4)

I am running Python3.4 on Windows 7. I am trying to use the Python interface for graphviz. This is the script I intend to run:

from graphviz import Digraph import pydotplus dot = Digraph(comment='The Round Table') dot.node('A', 'King Arthur') dot.node('B', 'Sir Bedevere the Wise') dot.node('L', 'Sir Lancelot the Brave') dot.edges(['AB', 'AL']) dot.edge('B', 'L', constraint='false') print(dot.source) dot.render('test-output/round-table.gv', view=True) 

At runtime, the following error appears:

 RuntimeError: failed to execute ['dot', '-Tpdf', '-O', 'test-output/round-table.gv'], make sure the Graphviz executables are on your systems' path 

Now I'm sure I installed the correct dependencies correctly. At first I tried to set the correct environment variables. The graphviz executables are located in C: \ Program Files (x86) \ Graphviz2.37 \ bin , so I went to the "Environment Variables" section. There are two sections here: user variables and system variables. In the "System Variables" section, I clicked on the Path , and then clicked Edit and added ; C: \ Program Files (x86) \ Graphviz2.37 \ bin at the end of the line and saved. This did not fix the error.

Then, after the answer here , I uninstalled pydot (I actually use pydotplus here) and installed it again, but still did not succeed.

I tried to fix this for hours, and the whole PATH variable is just confused and frustrating.

+11
source share
16 answers

It appears that Graphviz2.37 is known to have problems with the PATH variable on Windows. I deleted it, deleted the environment variables associated with it, and instead downloaded and installed the newer beta version 2.39, and now it works like a miracle.

+4
source

In my case (Win10, Anaconda3, Jupyter notebook) after "conda install graphviz" I need to add to PATH: C:\Users\username\Anaconda3\Library\bin\graphviz

To change PATH goto Control Panel > System and Security > System > Advanced System Settings > Environment Variables > Path > Edit > New

+12
source

On a jupyter (ipython) laptop with anaconda in win10, I solved the conda install graphviz after I installed graphviz pip install graphviz

+7
source

I also had a problem with Ubuntu 16.04.

Fixed when running sudo apt-get install graphviz in addition to the pip installation that I already completed.

+7
source

when you add C: \ Program Files (x86) \ Graphviz2.38 \ bin to PATH, then you must close the IDE, such as spyder and restart, you will solve "RuntimeError: make sure the Graphviz executables are on your way systems "

+5
source

I decided to install it directly from https://graphviz.gitlab.io/_pages/Download/Download_windows.html and include it in the window path:

 C:\Program Files (x86)\Graphviz2.38\bin C:\Program Files (x86)\Graphviz2.38 

After restarting Windows

+4
source

To solve this problem, when you successfully install graphviz2.38, add the PATH variable to the system path. In the system variables, you can click "Path" and then click "Change" and add: C: \ Program Files (x86) \ Graphviz2.38 \ bin to the end of the line and save. After that, restart your pythonIDE as spyper, then it works well.

Remember to close Spyder and reboot.

+4
source

Since Mac OS is not mentioned, I will add that I had the same problem for OS X Yosemite, the solution I found was to make brew install graphviz

This solved the problem, not sure if I shouldn’t just edit one of the other answers on this list, because they all seem the same, just install the official package in addition to the Python library.

+4
source

For Windows 8.1 and python 2.7, I fixed the problem by following these steps

1. Download and install graphviz-2.38.msi http://www.graphviz.org/pub/graphviz/stable/windows/graphviz-2.38.msi

2. Set the path variable

  • Control Panel> System and Security> System> Advanced System Settings> Environment Variables> Path> Change
  • add 'C: \ Program Files (x86) \ Graphviz2.38 \ bin'
+2
source

I had the same issue with Windows 10.

First I installed graphviz-2.38.0 with the following command without any problems ...

 install -c anaconda graphviz=2.38.0 

Secondly, I installed pydotplus with the following command without any problems ...

 install -c conda-forge pydotplus 

After that, when I got to my step to visualize my decision tree, the following problem arose with {InvocationException: GraphViz executables not found} ...

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

In my case, all I had to do to fix this was to put the environment path to the graphviz in my user PATH environment variable, and that fixed it. Just make sure this is the path where YOUR.exe files are YOUR.exe :)

 C:\Users\admin\Anaconda3\pkgs\graphviz-2.38.0-4\Library\bin\graphviz 
+1
source

Just install

 conda install graphviz 

then install

 conda install -c conda-forge pydotplus 
+1
source

If you use Win10, install Graphviz and then use the following command to add the path.

 import os os.environ["PATH"] += os.pathsep + 'C:\Program Files (x86)\Graphviz2.38/bin/' 
+1
source

Please note that I am using Windows 10. Some of the following may or may not apply to other versions of Windows or operating systems:

** Note 2: **
"The bin file address for Graphviz on your system" can be C: \ Program Files (x86) \ Graphviz2.38 \ bin or any other path that you installed in Graphviz.

We have problems not only with Graphviz, but also with other external EXE files that we want to use in Jupyter.
The reason is that when jupyter wants to import a package, it searches for it in the working directory, and when it cannot find the package, it returns such errors.
What we can do is solve the following:
1) check if Graphviz is installed on your system, and if not, you can download and install it from:

https://graphviz.gitlab.io/_pages/Download/Download_windows.html
and then install it. When installing Graphviz, remember where (in which folder) you install it. If you see the above error when using

 import graphviz 

then you have several options:

2) You can call the .exe file in ipynb via

 import os os.environ["PATH"] += os.pathsep + r'the Graphviz bin file address on your system' 

In my experience, it only works for the same ipynb that I work with, and every time I open the notebook, I need to call these lines of code.

3) If you need Jupyter, where to find the executable file, you need to specify the path to the environment.
On Windows 10, you can do this as follows:
Control Panel> System and Security> System> Advanced System Settings> Environment Variables> Path> Edit> Create
and then add "the address of the Graphviz bin file on your system." On Windows 8 or below, go to:
Control Panel> System and Security> System> Advanced System Settings> Environment Variables
and then add; (semicolon) + "bin file address on your Graphviz system" to the end of the path line
Note. Do not forget to restart your computer.

4) and even if this does not work, define a variable going to:
Control Panel> System and Security> System> Advanced System Settings> Environment Variables, and then:

Start to define an environmental variable

Then define the variable as follows: Remember to name the variable Graphviz

Remember to name the variable Graphviz. Finally reboot your computer and hope it works.

+1
source

I had the same issue on Ubuntu (14.04) with Jupyter.

To solve this problem, I added a point library in python sys.path

First: check if the point is set,

Then: find your path whereis dot / local / notebook / miniconda2 / envs / ik2 / bin / dot

Finally, in the python script: sys.path.append ("/ local / notebook / miniconda2 / envs / ik2 / bin / dot")

0
source

I am using Windows 10, Python 3.6 on Anaconda 3 and have encountered the same problem.

I worked by doing the following:

  • From Anaconda terminal: pip install pydotplus
  • From Anaconda terminal: conda install pydotplus
  • From Anaconda terminal: pip install graphviz
  • From Anaconda terminal: conda install graphviz
  • Moved to Windows Varialbes, PATH, and added the location of my dot.exe file to the graphviz directory in Anaconda.

worked after that.

0
source

Please use pydotplus instead of pydot

  1. Find: C:\Users\zhangqianyuan\AppData\Local\Programs\Python\Python36\Lib\site-packages\pydotplus

  2. Open graphviz.py

  3. Find line 1925 - line 1972, find function:

     def create(self, prog=None, format='ps'): 
  4. In the function, find:

     if prog not in self.progs: raise InvocationException( 'GraphViz\ executable "%s" not found' % prog) if not os.path.exists(self.progs[prog]) or \ not os.path.isfile(self.progs[prog]): raise InvocationException( 'GraphViz\ executable "{}" is not' ' a file or doesn\'t exist'.format(self.progs[prog]) ) 
  5. Between the two blocks add this (your path to the Graphviz executable):

      self.progs[prog] = "C:/Program Files (x86)/Graphviz2.38/bin/gvedit.exe"' 
  6. After adding, the result is:

     if prog not in self.progs: raise InvocationException( 'GraphViz\ executable "%s" not found' % prog) self.progs[prog] = "C:/Program Files (x86)/Graphviz2.38/bin/gvedit.exe" if not os.path.exists(self.progs[prog]) or \ not os.path.isfile(self.progs[prog]): raise InvocationException( 'GraphViz\ executable "{}" is not' ' a file or doesn\'t exist'.format(self.progs[prog]) ) 
  7. save the modified file and you can run it successfully.

  8. You better save it as a BMP file because the PNG file will not work. picture here

0
source

Source: https://habr.com/ru/post/981950/


All Articles