Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to downgrade tensorflow version in colab?

Tags:

I am using pip3 install tensorflow==1.8.0, but it doesn't have GPU support.

So I am using pip3 install tensorflow-gpu==1.8.0, but it still raises an exception

libcudart.so.VERSION No such file.

Should I use colab to install tensorflow from source?

After pip3 list:

tensorboard              1.10.0    tensorflow               1.10.0    tensorflow-hub           0.1.1    
like image 985
二进制 Avatar asked Aug 17 '18 03:08

二进制


People also ask

How do I downgrade TensorFlow?

The best practice for TensorFlow downgrade is to use the latest version of Python and TensorFlow. Older versions have vulnerability issues, so be cautious when downgrading. Set the version to a lower number than the currently installed release. When choosing, make sure the version is compatible with the Python release.

How do I find the version of TensorFlow on Google Colab?

To check your TensorFlow version in your Jupyter Notebook such as Google's Colab, use the following two commands: import tensorflow as tf This imports the TensorFlow library and stores it in the variable named tf . print(tf. __version__) This prints the installed TensorFlow version number in the format x.y.z .


2 Answers

You can downgrade Tensorflow to a previous version without GPU support on Google Colab. I ran:

!pip install tensorflow==1.14.0 import tensorflow as tf print(tf.__version__) 

which initially returned

2.0.0-dev20190130 

but when I returned to it after a few hours, I got the version I requested:

1.14.0 

Trying to downgrade to a version with GPU support:

!pip install tensorflow-gpu==1.14.0 

requires restarting the runtime and fails, as importing import tensorflow as tf returns:

 ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory 

Update

When the import fails you can always downgrade CUDA to version 9.0 using following commands

!wget https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb !dpkg -i cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb !apt-key add /var/cuda-repo-9-0-local/7fa2af80.pub !apt-get update !apt-get install cuda=9.0.176-1 

You can check the version of CUDA by running:

!nvcc --version 

Second update

This code now seems to fail, see the follow-up question at How to downgrade to tensorflow-gpu version 1.12 in google colab

like image 55
miguelmorin Avatar answered Sep 22 '22 18:09

miguelmorin


Google recommends you not to do pip installs!!!!

  1. use this instead: %tensorflow_version 1.x

  2. Restart the Runtime and check if its changed:

import tensorflow print(tensorflow.__version__) 

Here is a link to the main article:
https://colab.research.google.com/notebooks/tensorflow_version.ipynb#scrollTo=8UvRkm1JGUrk

like image 32
madakasira pradeep kumar Avatar answered Sep 19 '22 18:09

madakasira pradeep kumar