Unable to install keras==2.2.4 in Google Colab environment

Asked 1 years ago, Updated 1 years ago, 123 views

After installing to the following version on Google colab,

!pip install tensorflow==1.14.0
! pip install keras == 2.2.4
! pip install tqdm

Importing each library

import tensorflow as tf
print(tf.__version__)

import keras
print(keras.__version__)

import tqdm
print(tqdm.__version__)

The following error occurred:

1.14.0
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-4-caa506f695aa>in<module>()
      2 print(tf.__version__)
      3 
---->4 import keras
      5 print(keras.__version__)
      6 

8 frames
/usr/local/lib/python 3.7/dist-packages/keras/initializers/initializers_v1.py in<module>()
     19 
     20 
--- >21_v1_zeros_initializer = tf.compat.v1.zeros_initializer
     22_v1_ones_initializer = tf.compat.v1.ones_initializer
     23_v1_constant_initializer = tf.compat.v1.constant_initializer

AttributeError: module 'tensorflow._api.v1.compat.v2.compat 'has no attribute'v1'

About a month ago, I didn't get this error and it worked fine.
This error occurred suddenly today.

If there is a solution to this, please let me know.

tensorflow keras google-colaboratory

2022-09-30 20:23

1 Answers

Google Collaboration already has TensorFlow and Keras set up and will be available by executing the magic command below.

%tensorflow_version 1.x

magic command


2022-09-30 20:23

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.