Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.0k views
in Technique[技术] by (71.8m points)

google colaboratory - How to downgrade tensorflow version in colab?

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   
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...