ImportError: Failed to import pydot. You must install pydot and graphviz for `pydotprint` to work. in Python
I have seen a similar issue but it is not solved either, so I decided to ask.
I am trying to visualize my model in Keras using
from keras.utils import plot_model plot_model(model, to_file='model.png')
But it showed an error :
ImportError: Failed to import pydot. You must install pydot and graphviz for `pydotprint` to work.
Please tell me how can I resolve this issue?
Suthep Sangvirotjanaphat May 30 2021
You need to install two packages
conda install pydotplus conda install graphviz
And import them:
import pydotplus from keras.utils import plot_model keras.utils.vis_utils.pydot = pydotplus plot_model(your_model_name, to_file='model.png', show_shapes=True)
It's resolved this issue for me.
Đàm Ngọc Sơn May 30 2021
You need to install some packages below. The following commands solved the problem for me:
pip install pydot
pip install pydotplus
sudo apt-get install graphviz
I hope it works for you.