close

[Solved] ImportError: cannot import name ‘plot_model’ from ‘keras.utils’

Hello Guys, How are you all? Hope You all Are Fine. Today I am just importing plot_model But I am facing following error ImportError: cannot import name ‘plot_model’ from ‘keras.utils’ in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How ImportError: cannot import name ‘plot_model’ from ‘keras.utils’ Error Occurs ?

I am just importing plot_model Just like This.

from keras.utils import plot_model

And I am facing following error.

ImportError: cannot import name 'plot_model' from 'keras.utils' (/usr/local/lib/python3.7/dist-packages/keras/utils/__init__.py)

How To Solve ImportError: cannot import name ‘plot_model’ from ‘keras.utils’ Error ?

  1. How To Solve ImportError: cannot import name ‘plot_model’ from ‘keras.utils’ Error ?

    To Solve ImportError: cannot import name ‘plot_model’ from ‘keras.utils’ Error Try to import in the below format. from keras.utils.vis_utils import plot_model Or Import like this from tensorflow.keras.utils import plot_model This will solve your error.

  2. ImportError: cannot import name ‘plot_model’ from ‘keras.utils’

    To Solve ImportError: cannot import name ‘plot_model’ from ‘keras.utils’ Error Try to import in the below format. from keras.utils.vis_utils import plot_model Or Import like this from tensorflow.keras.utils import plot_model This will solve your error.

Solution 1: import in the below format

Try to import in the below format.

from keras.utils.vis_utils import plot_model // Now Your Error should be solved

Solution 2: Import like this

Import like this

from keras.utils.vis_utils import plot_model

or

from tensorflow.keras.utils import plot_model

Summary

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also, Read

Leave a Comment