'Persistent error: pydot and graphviz ('Failed to import pydot)

   from tensorflow.keras.models import load_model

I am working from Spyder and on windows 10. I have tried almost any solutions available on the stackoverflow and internet, and still having the same problem. When I install pydot, graphviz, pydot-ng, either through conda, or pip or pip3, and manually installing graphviz through windows insaller and adding its path to the system, I still get the same error as below:

    plot_model(model, to_file='model_plot.png', show_shapes=True, show_layer_names=True)

('Failed to import pydot. You must pip install pydot and install graphviz (https://graphviz.gitlab.io/download/), ', 'for pydotprint to work.')

On my spyder, when I say either of these, I get this error:

    ModuleNotFoundError: No module named 'pydot'

or:

    ModuleNotFoundError: No module named 'pydotplus'

I also restarted the kerner but did not help!



Solution 1:[1]

Run in console or install for conda environment

pip install pydot

install graphviz for windows https://graphviz.org/download/ , install as Administrator

restart conda

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Peter Pirog