Graphviz does not run

I trying to show a graph with graphviz,i alredy add the enviroment variables to the system,but i can run the module yet,he continue showing the same error

ExecutableNotFound: failed to execute ['dot', '-Tpdf', '-O', 'doencasCardiovasculares'], make sure the Graphviz executables are on your systems' PATH

Any solutions?

This is what a trying to do

import graphviz 
dot_data = tree.export_graphviz(cardio_classificador, out_file=None) 
graph = graphviz.Source(dot_data) 
graph.render("doencasCardiovasculares") 

Complete log

c:\users\lopes\documents\trabalho_ia\lib\site-packages\graphviz\backend.py in run(cmd, input, capture_output, check, encoding, quiet, **kwargs)
    163     try:
--> 164         proc = subprocess.Popen(cmd, startupinfo=get_startupinfo(), **kwargs)
    165     except OSError as e:

c:\python39\lib\subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, user, group, extra_groups, encoding, errors, text, umask)
    946 
--> 947             self._execute_child(args, executable, preexec_fn, close_fds,
    948                                 pass_fds, cwd, env,

c:\python39\lib\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_gid, unused_gids, unused_uid, unused_umask, unused_start_new_session)
   1415             try:
-> 1416                 hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
   1417                                          # no special security

FileNotFoundError: [WinError 2] O sistema não pode encontrar o arquivo especificado

During handling of the above exception, another exception occurred:

ExecutableNotFound                        Traceback (most recent call last)
<ipython-input-13-d199a0947a15> in <module>
      2 dot_data = tree.export_graphviz(cardio_classificador, out_file=None)
      3 graph = graphviz.Source(dot_data)
----> 4 graph.render("doencasCardiovasculares")

c:\users\lopes\documents\trabalho_ia\lib\site-packages\graphviz\files.py in render(self, filename, directory, view, cleanup, format, renderer, formatter, quiet, quiet_view)
    205             format = self._format
    206 
--> 207         rendered = backend.render(self._engine, format, filepath,
    208                                   renderer=renderer, formatter=formatter,
    209                                   quiet=quiet)

c:\users\lopes\documents\trabalho_ia\lib\site-packages\graphviz\backend.py in render(***failed resolving arguments***)
    219         cwd = None
    220 
--> 221     run(cmd, capture_output=True, cwd=cwd, check=True, quiet=quiet)
    222     return rendered
    223 

c:\users\lopes\documents\trabalho_ia\lib\site-packages\graphviz\backend.py in run(cmd, input, capture_output, check, encoding, quiet, **kwargs)
    165     except OSError as e:
    166         if e.errno == errno.ENOENT:
--> 167             raise ExecutableNotFound(cmd)
    168         else:
    169             raise

ExecutableNotFound: failed to execute ['dot', '-Tpdf', '-O', 'doencasCardiovasculares'], make sure the Graphviz executables are on your systems' PATH

Upvotes: 2

Views: 1170

Answers (1)

mrazizi
mrazizi

Reputation: 326

As @jasonharper mentions, it seems like graphviz is not installed on your system.

Try installing graphviz using the following command:

sudo apt install graphviz

edit:

According to @vaettchen's comment, it looks like you're using Windows. So this link may help.

Upvotes: 1

Related Questions