importerror:failed to import Pydot. You are must install Pydot and Graphviz for ' pydotprint ' to work.

Source: Internet
Author: User
Tags keras keras model


When I used the Keras visualization model, I met the above error with the following error message:





Traceback (most recent call last):
  File "HARRISON_feature_model.py", line 55, in <module>
    plot_model(model, to_file='vgg_feature_model.png', show_shapes=True, show_layer_names=False)  
  File "/home/idc/anaconda3/envs/hashtag/lib/python2.7/site-packages/keras/utils/vis_utils.py", line 131, in plot_model
    dot = model_to_dot(model, show_shapes, show_layer_names, rankdir)
  File "/home/idc/anaconda3/envs/hashtag/lib/python2.7/site-packages/keras/utils/vis_utils.py", line 52, in model_to_dot
    _check_pydot()
  File "/home/idc/anaconda3/envs/hashtag/lib/python2.7/site-packages/keras/utils/vis_utils.py", line 27, in _check_pydot
    raise ImportError('Failed to import pydot. You must install pydot'
ImportError: Failed to import pydot. You must install pydot and graphviz for `pydotprint` to work.



The solution is:







Pip install pydot-ng
pip install Graphviz
And then it's solved, my system for Ubuntu 16.04





Or:





sudo pip3 install pydot
sudo pip3 install graphviz sudo apt-get install Graphviz

The solution below is also Ubuntu 16.04, but it's Python3.

 Reference Documents

[1]. Keras implement LENET-5 Network and visualize network structure diagram. http://blog.csdn.net/qqadssp/article/details/70431236 

[2].keras Model Visualization and resolution ' Failed to Import Pydot ' problem. http://www.zhimengzhe.com/linux/353667.html



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.