Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

plot_model not working because "dot" with args

Tags:

model

keras

When i'm trying to use plot_model it doesn'to work:

from keras.utils.vis_utils import plot_model
plot_model(model, to_file='model_plot.png', show_shapes=True, show_layer_names=True)

and i get this message in the terminal:

"dot" with args ['-Tps', 'C:\Users\CHETEM~1\AppData\Local\Temp\tmprst0j6pn'] returned code: 1

stdout, stderr: b'' b"'C:\Users\Chete' is not recognized as an internal or external command,\r\noperable program or batch file.\r\n"

any one have any idea?

like image 214
Jose Ramon Medina Lorente Avatar asked Jan 20 '26 05:01

Jose Ramon Medina Lorente


1 Answers

Not sure why it happens but it looks like graph viz does not configure the plugins when it got installed, I had the same issue and I simply fixed it by:

  1. Open CMD with administrator privileges (simply right click on the CMD and click "run as administrator")
  2. Insert the command dot -c, this will configure the GraphViz plugins

After this simple fix I was able to plot Keras models.

like image 152
JumbaMumba Avatar answered Jan 23 '26 21:01

JumbaMumba