pythonkerasdependenciesgraphvizpydot

AttributeError: module 'pydot' has no attribute 'InvocationException'


Problem:

  1. I want to use plot_model from keras.utils to draw a beautiful AI model layers map;
  2. The tool plot_model requires "pydot" and "graphviz";
  3. I installed "pydot" using Anaconda Prompt (pip install pydot), and "graphviz" using the installer EXE;
  4. Instead of a beautiful graph, I'm getting AttributeError: module 'pydot' has no attribute 'InvocationException'.

Question: how to make the error go away and the code run correctly?

Edit: The error AttributeError: module 'pydot' has no attribute 'InvocationException' is caused by a FileNotFoundError: [WinError 2] "dot" not found in path. error, that is caused by a FileNotFoundError: [WinError 2] O sistema não pode encontrar o arquivo especificado error.


Solution

  • It is a pydot version incompatibility, as seen on GitHub.

    Do pip install pydot==2.0.0 and it will work, as said by syedalimohsinbukhari.