AttributeError: module ‘tensorflow’ has no attribute ‘ConfigProto’

ConfigProto disappeared in tf 2.0, so an elegant solution is:

import tensorflow as tf

and then replace:

tf.ConfigProto by tf.compat.v1.ConfigProto

In fact, the compatibility built in 2.0 to get tf 1.XX: tf.compat.v1 is really helpful.

Useful link:
Migrate your tensorflow 1. code to tensorflow 2.:
https://www.tensorflow.org/guide/migrate

Leave a Comment