Cant install tensorflow-gpu in google colab, what am i doing wrong?

3.7k Views Asked by At

When trying to install tensorflow to the gpu in google colab i get an error message.

code being used

I have looked at several forums and tutorials but i seem to be the only one getting this error message so i was wondering if anyone knows how to solve this. I am already connected to the gpu aswell.

1

There are 1 best solutions below

0
AudioBubble On

You need not to install the tensorflow-gpu version in Google Colab explicitly. You can simply select Hardware accelerator = GPU and can use the tensorflow as GPU version in Google Colab.

Please follow this path to enable GPU mode in `Google Colab:

(Top Menu bar) Select Runtime -> Change runtime type -> Hardware accelerator -> Select GPU -> Save

Now run below code in Google Colab to check if GPU is enabled.

import tensorflow as tf
physical_devices = tf.config.list_physical_devices('GPU')

print("GPU:", tf.config.list_physical_devices('GPU'))
print("Num GPUs:", len(physical_devices))

Output:

GPU: [PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]
Num GPUs: 1