ImportError: No module named pydot ( unable to import pydot)

Sanchit Aluna picture Sanchit Aluna · Feb 3, 2016 · Viewed 43.7k times · Source

I am unable to import the pydot package in Spyder, Could you please help me out is there any other way to import it. I need it for decision tree visualization. The statement

import pydot

is not working.

Answer

Eugenie picture Eugenie · Mar 28, 2017
pip install pydot
pip install graphviz

there is a similar problemm: Keras: "RuntimeError: Failed to import pydot." after installing graphviz and pydot

pip installs pydot, but not GraphViz. The GraphViz binary files (dot, neato, etc.) need to be downloaded and installed separately from pydot. In addition, the location of these executables should be added to the $PATH environment variable (or equivalent in your operating system). Otherwise pydot won't find dot when looking in directories included in the current path.