TensorFlow 2.0 dataset.__iter__() is only supported when eager execution is enabled
I fixed it by enabling eager execution after importing tensorflow:
import tensorflow as tf
tf.enable_eager_execution()
Reference: Tensorflow
In case you are using Jupyter notebook after
import tensorflow as tf
tf.enable_eager_execution()
You need to restart the kernel and it works