Error in mglean.plots.plot_animal_tree()

Asked 2 years ago, Updated 2 years ago, 96 views

I'm studying machine learning starting at Python in O'Reilly.
Anaconda is using iPython.PC is Windows 10.

An error occurred in mglearn.plots.plot_animal_tree() in the decision tree.
I was told to install graphviz, so I installed it with pip and passed Path through the environment variable, but it didn't work because of the error below.

FileNotFoundError: [WinError2] The specified file cannot be found.
ExcutableNotFoud: failed to execute ['dot', '-Tpng', '-O', 'tmp'], make sure the Graphviz executable are on your systems' PATH

I thought I had to install graphviz on conda, so I ran conda install graphviz, but

Note: you may need to restart the kernel to use update packages

cannot be installed.

What should we do to solve this problem?Thank you for your cooperation.

anaconda graphviz

2022-09-30 10:46

1 Answers

Answer
 mglean.plots.plot_animal_tree() should display the image using the step below.

  • 1) Otherwise, the following error will occur:
  • 5) or there will be no video and no errors.
    The graphviz here is to use 1) graphviz(dot) from Python.
  • I haven't checked, but I feel that Channels in 3) and Channels must be the same when executing code.
ExcutableNotFoud: failed to execute ['dot', '-Tpng', '-O', 'tmp'], make sure the Graphviz executable are on your systems' PATH

Step
 1)Install graphviz on Win10
  Add a path with dot.exe to the environment variable Path
 2)Launch Anaconda Navigator on Win10
 3)Launch CMD.exe Prompt at ANACONDA NAVIGATOR
 4)Install mglearn on CMD

 pip install mglearn

5) Install graphviz on CMD

 pip install graphviz

Confirmed Code

import mglearn
mglearn.plots.plot_animal_tree()

Results
Enter a description of the image here


2022-09-30 10:46

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.