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.
Since today thomas-schiex/blender cannot be installed on Google Colab due to dependency issues.
There is alternative way how to install blender on Google Colab. I've tested it today on Google Colab and it seems to be working fine.
Guide is available at: https://gist.github.com/agmmnn/c457286aef0e271a68234d4c59c85d46