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

I saw a similar problem, but it is also not resolved, so I decided to ask.

I am trying to introduce my model in keras using

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

Firstly, he showed a mistake

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

Accordingly, I installed pydot and graphviz through the Anaconda prompt activating my environment using

 conda install -c https://conda.binstar.org/t/TOKEN/j14r pydot conda install -c https://conda.binstar.org/t/TOKEN/j14r graphviz 

Then I closed the spyder and reopened it. When I run the code snippet, it still shows the same error. What am I missing?

+6
source share
5 answers

Use the following command to install them:

 sudo apt install python-pydot python-pydot-ng graphviz 
+2
source

The following teams solved the problem for me

  1. pip install pydot
  2. pip install pydotplus
  3. sudo apt-get install graphviz
+1
source

For me, all I had to do was install graphviz and pydot:

On Python3:

 pip3 install pydot-ng pip3 install graphviz 

In Python2:

 pip3 install pydot-ng pip3 install graphviz 

This solved the error for me.

0
source

Restarting the Kernel solved the problem for me, without the need for pydot-ng.

0
source

These commands work for me. I did:

 conda install -c https://conda.binstar.org/t/TOKEN/j14r pydot conda install -c https://conda.binstar.org/t/TOKEN/j14r graphviz sudo apt install python-pydot python-pydot-ng graphviz 
0
source

Source: https://habr.com/ru/post/1273807/


All Articles