How to downgrade tensorflow version in colab?

不问归期 提交于 2020-01-13 04:30:10

问题


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   

回答1:


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

!pip install tensorflow==1.12.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.12.0

Trying to downgrade to a version with GPU support:

!pip install tensorflow-gpu==1.12.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




回答2:


The build process for GPU-enabled tensorflow is involved. In particular, old versions of TensorFlow use (or require) older versions of CUDA, which itself depends on system libraries and configuration beyond the scope of a pip install.

I suspect that downgrading TensorFlow on a VM configured for a newer version is going to be an involved process, perhaps involving downgrades / reinstalls of system libraries.

If it's practical, it might be simpler to update your code to use the latest version of TensorFlow, at least until Colab supports persistent backend enivronments.



来源:https://stackoverflow.com/questions/51888118/how-to-downgrade-tensorflow-version-in-colab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!