Search code examples
pythonspyderpydot

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


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.


Solution

  • 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.