AttributeError: module 'tensorflow' has no attribute 'compat' when loading tf.compat.v1.train.SessionRunHook
This is usually caused by the broken TensorFlow-estimator module.
simply do a
pip install tensorflow-estimator==2.1.*
Special note for Conda users:
When one enters conda install tensorflow
it installs 2.1.0 but it brings with it tensorflow-estimator 2.2.0. To fix this problem simply run conda install tensorflow-estimator==2.1.0
after installing tensorflow 2.1.0 in Conda.
This advice is valid until conda switches to TF 2.2.0 (or better yet to 2.3.0)
credits to this TF github thread
UPDATE: as of 10-Dec-2020 Conda has TF 2.3.0 for Windows and 2.2.0 for Linux. Check here to see current state of TF support in Conda.