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?
-
S1
Suthep Sangvirotjanaphat May 30 2021
You need to install two packages
pydotplus
&graphviz
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.
-
Đ0
Đàm Ngọc Sơn May 30 2021
You need to install some packages below. The following commands solved the problem for me:
Step 1:
pip install pydot
Step 2:
pip install pydotplus
Step 3:
sudo apt-get install graphviz
I hope it works for you.
* Type maximum 2000 characters.
* All comments have to wait approved before display.
* Please polite comment and respect questions and answers of others.