I try to run this example for decision tree learning, but get the following error message:
File \"coco.py\", line 18, in graph.write_pdf(\"iris.pdf
brew install graphviz
pip install -U pydotplus
... worked for me on MacOSX
conda install -c anaconda graphviz
conda install -c anaconda pydot
For windows users:
1.install Graphviz
2.Add Graphviz path to PATH variable
3.Restart PyCharm or other compiler.
As of version 2.31, the Visual Studio package no longer alters the PATH variable or accesses the registry at all. If you wish to use the command-line interface to Graphviz or are using some other program that calls a Graphviz program, you will need to set the PATH variable yourself.
On mac, use Brew to install graphviz and not pip, see links:
graphviz information: http://www.graphviz.org/download/
brew installation: https://brew.sh/
So typing the following in the terminal after you install brew should work:
brew install graphviz
Worked for me on Ubuntu 18.04 as well:
$ sudo apt-get install graphviz