I wasn't able to find any solution to this issue for one hour and decided better to ask here. The only rich info is given here with no detailed instructions to match my case.
I am on Windows 10, using PyCharm to connect to offline Ubuntu 16.04 server to try some machine learning classification.
The code is working to some point, then throwing this
Traceback (most recent call last):
File "/home/user/.local/lib/python3.5/site-packages/graphviz/backend.py", line 159, in run
proc = subprocess.Popen(cmd, startupinfo=get_startupinfo(), **kwargs)
File "/usr/lib/python3.5/subprocess.py", line 947, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child
raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'dot'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/user/project/2_input/xgboost_loop.py", line 55, in <module>
xgb.plot_tree(classifier, ax=plt.gca())
File "/home/user/.local/lib/python3.5/site-packages/xgboost/plotting.py", line 281, in plot_tree
s.write(g.pipe(format='png'))
File "/home/user/.local/lib/python3.5/site-packages/graphviz/files.py", line 138, in pipe
quiet=quiet)
File "/home/user/.local/lib/python3.5/site-packages/graphviz/backend.py", line 229, in pipe
out, _ = run(cmd, input=data, capture_output=True, check=True, quiet=quiet)
File "/home/user/.local/lib/python3.5/site-packages/graphviz/backend.py", line 162, in run
raise ExecutableNotFound(cmd)
graphviz.backend.ExecutableNotFound: failed to execute ['dot', '-Tpng'], make sure the Graphviz executables are on your systems' PATH
Process finished with exit code 1
I checked via pip list
that I do have graphviz
version 0.13.2
on Ubuntu server. One suggested in the above given link that the output of whereis dot
should be added as os.environ["PATH"] += os.pathsep + 'OUTPUT'
to the file to be run, but there isn't any output except dot:
.
Locally, I also checked that I have the same graphviz
version 0.13.2
.