Blender on Google Colab not finding Graphics Card Up until few days ago I was able to run Blender(or sheep it) headless on Google Colab with an GPU(K80 or T4). Now running keras/tensorflow does work fine but blender cant detect the GPU at all and Sheepit tells me that 


  "cuInit Failed ret: 100"


nvidia-smi results with:

Sat Aug 24 19:48:06 2019       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 430.40       Driver Version: 418.67       CUDA Version: 10.1     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  Tesla K80           Off  | 00000000:00:04.0 Off |                    0 |
| N/A   33C    P8    25W / 149W |      0MiB / 11441MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+


The following script did work fine for few months and detected the GPU properly and setup blender to use the available GPU.
https://gist.github.com/donmahallem/a05100077ec1327268f28f0b2bd8da60

I tried a lot but my nvidia/unix foo is pretty limited. I tried to find out if the CUDA Version changed and tried to downgrade the cuda version to 9.2 but couldn't get it to work again.
I'm also facing the same problem. I think colab is not allowing GPU to use for any commands that include "sudo" in it.

Solution I found was to install blender and then run the command to render without "sudo".

I installed blender from PPA ppa:thomas-schiex/blender

commands to execute:

!sudo add-apt-repository ppa:thomas-schiex/blender
!sudo apt-get install blender
!blender -b -P script.py filename.blend -o fileoutput -F PNG -f 1


script.py contains code to select gpu, I generally upload to colab. Save following code as script.py

import bpy, _cycles

bpy.context.scene.cycles.device = 'GPU'

avail_devices = _cycles.available_devices('CUDA')
print(avail_devices)

prop = bpy.context.preferences.addons['cycles'].preferences

prop.get_devices(prop.compute_device_type)
prop.compute_device_type = 'CUDA'

for device in prop.devices:
    if device.type == 'CUDA':
        print('device: ', device)
        device.use = True


this worked for me !