[Solved]: Module 'tensorflow' has no attribute 'contrib'

tf.contrib has moved out of TF starting TF 2.0 alpha.
Take a look at these tf 2.0 release notes 

https://github.com/tensorflow/tensorflow/releases/tag/v2.0.0-alpha0

You can upgrade your TF 1.x code to TF 2.x using the tf_upgrade_v2 script 

https://www.tensorflow.org/alpha/guide/upgrade

if you want o=to work on older version then you can specify that version with pip

$ pip install tensorflow==1.13.1