Hello Guys, How are you all? Hope You all Are Fine. I am running a tensorflow model on google colab. Today, I got this error: AttributeError: module ‘tensorflow._api.v1.compat.v2’ has no attribute ‘internal‘ google colab error in Python. So Here I am Explain to you all the possible solutions here.
Without wasting your time, Let’s start This Article to Solve This Error.
How AttributeError: module ‘tensorflow._api.v1.compat.v2’ has no attribute ‘internal‘ google colab error Occurs ?
I am running a tensorflow model on google colab. Today, I got this error:
File "/usr/local/lib/python3.7/dist-packages/keras/initializers/__init__.py", line 49, in populate_deserializable_objects
LOCAL.GENERATED_WITH_V2 = tf.__internal__.tf2.enabled()
File "/usr/local/lib/python3.7/dist-packages/tensorflow_core/python/util/module_wrapper.py", line 193, in __getattr__
attr = getattr(self._tfmw_wrapped_module, name)
AttributeError: module 'tensorflow._api.v1.compat.v2' has no attribute '__internal__'
How To Solve AttributeError: module ‘tensorflow._api.v1.compat.v2’ has no attribute ‘internal‘ google colab error?
How To Solve AttributeError: module ‘tensorflow._api.v1.compat.v2’ has no attribute ‘internal‘ google colab error?
To Solve AttributeError: module ‘tensorflow._api.v1.compat.v2’ has no attribute ‘internal‘ google colab error running this code to downgrade your tensorflow !pip install tensorflow==1.13.0 I replaced it with: %tensorflow_version 1.x and Everything else remains the same. It worked!
Solution 1
this parameter works for me
!pip3 uninstall keras-nightly
!pip3 uninstall -y tensorflow
!pip3 install keras==2.1.6
!pip3 install tensorflow==1.15.0
!pip3 install h5py==2.10.0
Solution 2
running this code to downgrade your tensorflow
!pip install tensorflow==1.13.0
I replaced it with:
%tensorflow_version 1.x
Everything else remains the same. It worked!
solution 3
try this one :
!pip uninstall keras-nightly
!pip install h5py==2.10.0
Summery
It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?
Also Read