Diagram
AttributeError: module tensorflow has no attribute ConfigProto error occurs in Python because, with the advent of TensorFlow 2.x, ConfigProto was removed from the TensorFlow module.
What is ConfigProto?
ConfigProto is a configuration protocol used in TensorFlow 1.x versions. It handled session configuration, such as limiting resource use and facilitating logging.
Changes from TensorFlow 1.x to 2.x
TensorFlow 2.x brought many changes. The most significant was the shift to Eager execution, making TensorFlow more intuitive and user-friendly. However, some changes, like removing ConfigProto, can cause confusion and errors for those used to TensorFlow 1.x.
How TensorFlow 2.x handles configurations
In TensorFlow 2.x, the ConfigProto function’s features are integrated into other parts of the module, eliminating the need for ConfigProto.
How to Fix it?
Solution 1: Using tf.compat.v1
If your existing code uses ConfigProto, you can use the compatibility module tf.compat.v1 to avoid errors. It allows you to run TensorFlow 1.x code in TensorFlow 2.x.
Solution 2: Other methods to manage session configuration
Instead of ConfigProto, you can use other methods like tf.config.experimental to manage resource consumption and other settings in TensorFlow 2.x.
Best Practices when Updating TensorFlow
Upgrade your TensorFlow library to the latest version. You can do this by running the following command in your terminal:
pip install --upgrade tensorflow
If you are using Anaconda, you can run the following command:
conda update tensorflow
Community resources and TensorFlow updates
Follow the TensorFlow community on GitHub, StackOverflow, and other forums. They often provide useful information about updates and solutions to common issues.
Conclusion
It’s common to run into AttributeErrors like ‘module tensorflow has no attribute ConfigProto’ when transitioning from TensorFlow 1.x to 2.x. However, understanding the changes and knowing how to adapt to them makes the process smoother.
That’s it.

Krunal Lathiya is a seasoned Computer Science expert with over eight years in the tech industry. He boasts deep knowledge in Data Science and Machine Learning. Versed in Python, JavaScript, PHP, R, and Golang. Skilled in frameworks like Angular and React and platforms such as Node.js. His expertise spans both front-end and back-end development. His proficiency in the Python language stands as a testament to his versatility and commitment to the craft.