I have looked into it, looks like kaggle is using the old version of keras_preprocessing,update it to the latest github version, and after you have installed it import imagedatagenerator from keras_preprocessing.image not from keras.preprocessing, and also even after installing make sure the latest version is being used not the old one from memory, if you have hard time installing it and get it working(like me 😐) simply download this file https://raw.githubusercontent.com/keras-team/keras-preprocessing/d3d58f5c6e2ef8b6270301415738ecb6deee2042/keras_preprocessing/image.py using wget and save it as im.py and from im import ImageDataGenerator