Headless render: can't find compute_device in 2.78b On Ubuntu 16.04 (used as a headless renderer with dual GTX 970 STRIX GPUs) after upgrading to blender 2.78b I'm now seeing:

$ blender -b Lightsaber.blend -o //Lightsaber-tst-1_ -E CYCLES -F PNG -x 1 -P cuda0.py -f 1
AL lib: (WW) alc_initconfig: Failed to initialize backend "pulse"
ALSA lib pcm_dmix.c:1029:(snd_pcm_dmix_open) unable to open slave
AL lib: (EE) ALCplaybackAlsa_open: Could not open playback device 'default': No such file or directory
read blend: /home/shady/usermaatre/School/Lightsaber.blend
Traceback (most recent call last):
  File "/home/shady/usermaatre/School/cuda0.py", line 4, in &lt;module&gt;
    bpy.context.user_preferences.system.compute_device_type = 'CUDA'


The cuda0.py script is simple (it comes from BlenderArtists):

$ cat cuda0.py 
import bpy, _cycles

bpy.context.scene.cycles.device = 'GPU'
bpy.context.user_preferences.system.compute_device_type = 'CUDA'

# this is different in each cuda[x].py file, CUDA_0, CUDA_1, CUDA_2, CUDA_3
bpy.context.user_preferences.system.compute_device = 'CUDA_0'


I had been running NVIDIA-Linux-x86_64-367.44.run and cuda_7.5.18_linux.run so we tried upgrading to the latest NVIDIA-Linux-x86_64-375.39.run and cuda_8.0.61_375.26_linux.run but that did not help.

I figured maybe the CUDA card has been renamed, so I tried running the script at  How do I get Cycles to use GPU on a linux server? and I get a similar result:

$ blender -b -P compute_device_type.py 
AL lib: (WW) alc_initconfig: Failed to initialize backend "pulse"
ALSA lib pcm_dmix.c:1029:(snd_pcm_dmix_open) unable to open slave
AL lib: (EE) ALCplaybackAlsa_open: Could not open playback device 'default': No such file or directory
Traceback (most recent call last):
  File "/home/steven/usermaatre/School/compute_device_type.py", line 7, in &lt;module&gt;
    devt = sysp.compute_device_type
AttributeError: 'UserPreferencesSystem' object has no attribute 'compute_device_type'

Blender quit


I'm thinking that something has changed in the naming of the card? Is there a simple way to determine the card attributes? And should the 8.0 drivers work on a headless system or should I go back to 7.5? I'd really rather not have to drop back to 2.78a which had worked...
From the 2.78b, it's necessary to recover them via the preferences of the Cycles addon.
You cant get it with

bpy.context.user_preferences.addon['cycles'].preferences.compute_device_type


And for the devices:

for card in bpy.context.user_preferences.addons['cycles'].preferences.devices:
    print(card.name)