importerror: cannot import name ‘normalize’ from ‘keras.utils’

importerror_ cannot import name 'normalize' from 'keras.utils'

Importerror: cannot import name ‘normalize’ from ‘keras.utils‘ error occurs mainly because of incompatibility of syntax (importing statement). There are very common scenarios where we observe such incompatibility and that is the root cause for this error. In this article, We will explore the best ways to fix this error.


importerror: cannot import name ‘normalize’ from ‘keras.utils’ ( Solution )-

There are multiple causes and solutions for this cannot import the name ‘normalize’ from ‘keras.utils’ error. But the cause depends only on the context of the error. Let’s go one by one.

1. Using TensorFlow Keras with wrong import –

We all know TensorFlow 2.0 is nothing but keras only. Actually, Google Team has introduced Keras as an official module of Tensorflow 2.0 to make TensorFlow  developer-friendly.  Now the problem is we are all data scientists and developers, take the reference from the internet.  The syntax may be of TensorFlow Keras but the import statement is related to keras ( standalone version ).

Correct –

from tensorflow.keras.utils import normalize

Usually, people does this – WRONG

from keras.utils import normalize


2.  In intermediate Keras versions , normalize module is moved –

Secondly, In some of the intermediate versions of the keras , The developer moved this normalize module to np_utils package. Therefore, we need to improve the import statement accordingly. Here is the correct syntax for the same.

Syntax Correct Version –

from keras.utils.np_utils import normalize

However the Incorrect Version ( Specific Version Only)

from keras.utils import normalize


3. Upgrading Keras module –

Firstly, The best solution for any incompatibility issue is upgrading the same. The easiest way to upgrade any package is the pip. Here is the command to upgrade Keras Module.

pip install keras
cannot import name 'normalize' from 'keras.utils'
cannot import name ‘normalize’ from ‘keras.utils’


Most Importantly, We have explored the most common cause for the error (cannot import name ‘normalize’ from ‘keras.utils’) related to keras subpackage incompatibility. Above all, Still, if you are facing this error but with a different context, please let us know. We will assist you with the same.


Data Science Learner Team

Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for signup. A Confirmation Email has been sent to your Email Address.

Something went wrong.

Meet Abhishek ( Chief Editor) , a data scientist with major expertise in NLP and Text Analytics. He has worked on various projects involving text data and have been able to achieve great results. He is currently manages, where he and his team share knowledge and help others learn more about data science.
Thank you For sharing.We appreciate your support. Don't Forget to LIKE and FOLLOW our SITE to keep UPDATED with Data Science Learner