1

Colab does not allow to downgrade TensorFlow and says that only versions 2 is available. here is code and output:

!pip install tensorflow-gpu==1.15.2
import tensorflow as tf
print(tf.__version__)

output:

Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/
ERROR: Could not find a version that satisfies the requirement tensorflow-gpu==1.15.2 (from versions: 2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.4.4, 2.5.0, 2.5.1, 2.5.2, 2.5.3, 2.6.0, 2.6.1, 2.6.2, 2.6.3, 2.6.4, 2.6.5, 2.7.0rc0, 2.7.0rc1, 2.7.0, 2.7.1, 2.7.2, 2.7.3, 2.7.4, 2.8.0rc0, 2.8.0rc1, 2.8.0, 2.8.1, 2.8.2, 2.8.3, 2.8.4, 2.9.0rc0, 2.9.0rc1, 2.9.0rc2, 2.9.0, 2.9.1, 2.9.2, 2.9.3, 2.10.0rc0, 2.10.0rc1, 2.10.0rc2, 2.10.0rc3, 2.10.0, 2.10.1, 2.11.0rc0, 2.11.0rc1, 2.11.0rc2, 2.11.0)
ERROR: No matching distribution found for tensorflow-gpu==1.15.2
2.9.2

I tried this code by creating some new projects in Colab but I got no new results

s.pakdel
  • 11
  • 2

1 Answers1

0

To downgrade tensorflow in google colab you must downgrade the version of python because python3.8 is not compatible with tensorflow1.x. So, Downgrade the version of python to python3.7 and install tensorflow1.x. This will work.

1.At first, Install python==3.7 version.

!sudo apt-get update -y
!sudo apt-get install python3.7

#change alternatives
!sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
!sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 2

#check python version
!python --version
  1. The above code will install python3.7 version, but it is not mapped to colab kernel, so we must map newly installed python.
# install pip for python==3.7
!sudo apt-get install python3.7-distutils
!wget https://bootstrap.pypa.io/get-pip.py
!python get-pip.py

# install colab dependencies
!python -m pip install ipython ipython_genutils ipykernel jupyter_console prompt_toolkit httplib2 astor

# link to the old google package
!ln -s /usr/local/lib/python3.8/dist-packages/google \
       /usr/local/lib/python3.7/dist-packages/google

Let's check version of python again, it will be python==3.7.16:

!python --version
  1. Now, it's time to install tensorflow 1.x.
!pip install tensorflow==1.x

I hope that it will help to fix your issue.Thank you!

npn
  • 304
  • 1
  • 14