Up until few days ago I was able to run Blender(or sheep it) headless on Google Colab with an GPU(yes I checked trice that I selected a GPU Instance). Now running keras/tens
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.