ImportError: No module named 'keras.utils.visualize_util'

S.EB picture S.EB · Apr 20, 2017 · Viewed 21.8k times · Source

Hi when I am trying to run a code in keras it is showing me the following error:

from keras.utils.visualize_util import plot
ImportError: No module named 'keras.utils.visualize_util'

How can I solve this? thanks

Answer

Dr. Snoopy picture Dr. Snoopy · Apr 20, 2017

You will have to either fix the code manually, or downgrade Keras.

By looking at the commit history of that module, you can see that it was renamed on February 28, 2017 from visualize_util to vis_utils. The plot function was also renamed to plot_model.

You will have to update the code to reflect these changes, or use a proper Keras version where the code you are using was developed or tested.