how to install pydot & graphviz on google colab?

Delen Lawson picture Delen Lawson · Apr 16, 2018 · Viewed 7.2k times · Source

I'm trying plot my model on the google colab.

 from keras.utils import plot_model
 plot_model(model, to_file="model.png")

and I got this error:

 ImportError: Failed to import pydot. You must install pydot and graphviz for `pydotprint` to work.

I've installed pydot-ng and graphviz and I'm still can't get through this error.

Answer

Bob Smith picture Bob Smith · Apr 16, 2018

To install pydot, run:

!pip install -q pydot

Then, restart your VM to reload keras which should then detect pydot's existence. (Runtime menu -> Restart runtime...)