Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error with plot_animal_tree #18

Open
vnitinv opened this issue Dec 13, 2019 · 3 comments
Open

error with plot_animal_tree #18

vnitinv opened this issue Dec 13, 2019 · 3 comments

Comments

@vnitinv
Copy link

vnitinv commented Dec 13, 2019

import mglearn
mglearn.plots.plot_animal_tree()

error log

/opt/anaconda3/lib/python3.7/site-packages/sklearn/externals/six.py:31: DeprecationWarning: The module is deprecated in version 0.21 and will be removed in version 0.23 since we've dropped support for Python 2.7. Please rely on the official version of six (https://pypi.org/project/six/).
  "(https://pypi.org/project/six/).", DeprecationWarning)
/opt/anaconda3/lib/python3.7/site-packages/sklearn/externals/joblib/__init__.py:15: DeprecationWarning: sklearn.externals.joblib is deprecated in 0.21 and will be removed in 0.23. Please import this functionality directly from joblib, which can be installed with: pip install joblib. If this warning is raised when loading pickled models, you may need to re-serialize those models with scikit-learn 0.21+.
  warnings.warn(msg, category=DeprecationWarning)
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
/opt/anaconda3/lib/python3.7/site-packages/graphviz/backend.py in run(cmd, input, capture_output, check, quiet, **kwargs)
    158     try:
--> 159         proc = subprocess.Popen(cmd, startupinfo=get_startupinfo(), **kwargs)
    160     except OSError as e:

/opt/anaconda3/lib/python3.7/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, encoding, errors, text)
    774                                 errread, errwrite,
--> 775                                 restore_signals, start_new_session)
    776         except:

/opt/anaconda3/lib/python3.7/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, restore_signals, start_new_session)
   1521                             err_msg += ': ' + repr(err_filename)
-> 1522                     raise child_exception_type(errno_num, err_msg, err_filename)
   1523                 raise child_exception_type(err_msg)

FileNotFoundError: [Errno 2] No such file or directory: 'dot': 'dot'

During handling of the above exception, another exception occurred:

ExecutableNotFound                        Traceback (most recent call last)
<ipython-input-2-53d3a20defda> in <module>
      1 import mglearn
----> 2 mglearn.plots.plot_animal_tree()

/opt/anaconda3/lib/python3.7/site-packages/mglearn/plot_animal_tree.py in plot_animal_tree(ax)
     23     mygraph.edge("2", "5", label="True")
     24     mygraph.edge("2", "6", label="False")
---> 25     mygraph.render("tmp")
     26     ax.imshow(imread("tmp.png"))
     27     ax.set_axis_off()

/opt/anaconda3/lib/python3.7/site-packages/graphviz/files.py in render(self, filename, directory, view, cleanup, format, renderer, formatter, quiet, quiet_view)
    207         rendered = backend.render(self._engine, format, filepath,
    208                                   renderer=renderer, formatter=formatter,
--> 209                                   quiet=quiet)
    210 
    211         if cleanup:

/opt/anaconda3/lib/python3.7/site-packages/graphviz/backend.py in render(engine, format, filepath, renderer, formatter, quiet)
    204     else:
    205         cwd = None
--> 206     run(cmd, capture_output=True, cwd=cwd, check=True, quiet=quiet)
    207     return rendered
    208 

/opt/anaconda3/lib/python3.7/site-packages/graphviz/backend.py in run(cmd, input, capture_output, check, quiet, **kwargs)
    160     except OSError as e:
    161         if e.errno == errno.ENOENT:
--> 162             raise ExecutableNotFound(cmd)
    163         else:
    164             raise

ExecutableNotFound: failed to execute ['dot', '-Tpng', '-O', 'tmp'], make sure the Graphviz executables are on your systems' PATH
@vnitinv
Copy link
Author

vnitinv commented Dec 13, 2019

pip list o/p:

mglearn                            0.1.7  
graphviz                           0.13.2

@vnitinv
Copy link
Author

vnitinv commented Dec 13, 2019

Fixed with

brew install graphviz

@vnitinv vnitinv closed this as completed Dec 13, 2019
@amueller
Copy link
Owner

Sorry, this might indeed be a bit tricky right now. I might want to just have the image in the notebook instead.
I'll reopen this issue so I can fix that for the next print of the book.

@amueller amueller reopened this Dec 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants