1

I have installed graphviz using the following command on my MacOS: brew install graphviz and now it shows that my graphviz is up-to-date.

However on running the following code on my Jupyter notebook:

# Extract the small tree
tree_small = regressor1.estimators_[5]
# Save the tree as a png image
export_graphviz(tree_small, out_file = 'tree.dot', feature_names = home_data.columns, rounded = True, precision = 1)
(graph, ) = pydot.graph_from_dot_file('tree.dot')
graph.write_png('tree.png')

Its throwing the following error:

FileNotFoundError: [Errno 2] "dot" not found in path. ExecutableNotFound: failed to execute 'dot', make sure the Graphviz executables are on your systems' PATH*

Would appreciate if someone could help me with the same. PS: I am new to using MacOS, so I am not sure how to work with adding the dot in the PATH. I tried doing echo $PATH, it certainly doesn't include graphviz, but not sure how to check where exactly it got installed.

Thanks

larsks
  • 277,717
  • 41
  • 399
  • 399
veraliesim
  • 31
  • 1
  • 5
  • Does this answer your question? [Exception: "dot" not found in path in python on mac](https://stackoverflow.com/questions/40243753/exception-dot-not-found-in-path-in-python-on-mac) – Marek H Aug 08 '21 at 18:04
  • no. I have already tried running those commands through command line – veraliesim Aug 08 '21 at 18:36
  • 2
    You probably need to update `os.environ["PATH"]` to include the directory in which the `dot` command is installed. – larsks Aug 08 '21 at 18:45
  • did you google already "how to add path to PATH variable in mac" and "which in mac" (which is linux command to locate exec.) – Ferroao Aug 08 '21 at 18:52

0 Answers0