I am using Blender 2.80 on my local machine and the machines I am connecting to via ssh. My local machine is Ubuntu 18.04. I hope to use Blender to programmatically generate images as part of my code base, and to do this via ssh.
I installed Blender by taking the tar.bz2 file, and then running
tar -xvjf blender-2.80-d93a7290e506-linux-glibc224-x86_64.tar.bz2
and then in my ~/.bashrc
, I have:
export PATH=${HOME}/blender-2.80-d93a7290e506-linux-glibc224-x86_64:$PATH
I have the following minimal working example:
#!/usr/bin/env blender --python
import bpy
bpy.ops.render.render()
bpy.data.images['Render Result'].save_render(filepath='example.png')
Suppose that file is called example-make-image.py
. I call it via the following command:
$ blender --background --python example-make-image.py
Blender 2.80 (sub 74) (hash d93a7290e506 built 2019-06-11 23:26:36)
Read prefs: /home/user/.config/blender/2.80/config/userpref.blend
found bundled python: /home/user/blender-2.80-d93a7290e506-linux-glibc224-x86_64/2.80/python
Warning: 'OBJ_SEQUENCE_properties' doesn't contain '_PT_' with prefix & suffix
register_class(...):
Warning: 'OBJ_SEQUENCE_properties' doesn't contain '_PT_' with prefix & suffix
0 meshes freed
Fra:1 Mem:88.26M (0.00M, Peak 88.43M) | Time:00:00.08 | Syncing Cube
Fra:1 Mem:88.63M (0.00M, Peak 88.98M) | Time:00:00.08 | Syncing Light
Fra:1 Mem:88.64M (0.00M, Peak 88.98M) | Time:00:00.08 | Syncing Camera
Fra:1 Mem:88.64M (0.00M, Peak 88.98M) | Time:00:00.10 | Rendering 1 / 64 samples
Fra:1 Mem:88.64M (0.00M, Peak 88.98M) | Time:00:00.15 | Rendering 26 / 64 samples
Fra:1 Mem:88.64M (0.00M, Peak 88.98M) | Time:00:00.17 | Rendering 51 / 64 samples
Fra:1 Mem:88.64M (0.00M, Peak 88.98M) | Time:00:00.18 | Rendering 64 / 64 samples
Fra:1 Mem:48.48M (0.00M, Peak 88.98M) | Time:00:00.22 | Sce: Scene Ve:0 Fa:0 La:0
Blender quit
This will correctly generate an image example.png
which I can open to see. It's a gray-ish image of the standard starting cube.
Now I would like to do the same thing via ssh over other machines. Here's a naive way of doing it. I just ssh normally into my machine with no special arguments, but I get this:
$ blender --background --python example-make-image.py
Blender 2.80 (sub 74) (hash d93a7290e506 built 2019-06-11 23:26:36)
found bundled python: /home/user/blender-2.80-d93a7290e506-linux-glibc224-x86_64/2.80/python
Unable to open a display
Aborted (core dumped)
Fair enough. I follow these instructions to enable me to run graphics applications over ssh. I connect via ssh -X user@machine-address
, and I can confirm by running xterm &
that I can open png images remotely. But when I try to run the same blender script above, I get:
$ blender --background --python example-make-image.py
Blender 2.80 (sub 74) (hash d93a7290e506 built 2019-06-11 23:26:36)
debug1: client_input_channel_open: ctype x11 rchan 3 win 65536 max 16384
debug1: client_request_x11: request from 127.0.0.1 59644
debug1: channel 1: new [x11]
debug1: confirm x11
debug1: channel 1: FORCE input drain
debug1: channel 1: free: x11, nchannels 2
debug1: client_input_channel_open: ctype x11 rchan 3 win 65536 max 16384
debug1: client_request_x11: request from 127.0.0.1 59646
debug1: channel 1: new [x11]
debug1: confirm x11
debug1: channel 1: FORCE input drain
debug1: channel 1: free: x11, nchannels 2
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': Device or resource busy
found bundled python: /home/user/blender-2.80-d93a7290e506-linux-glibc224-x86_64/2.80/python
debug1: client_input_channel_open: ctype x11 rchan 3 win 65536 max 16384
debug1: client_request_x11: request from 127.0.0.1 59648
debug1: channel 1: new [x11]
debug1: confirm x11
Received X11 Error:
error code: 2
request code: 154
minor code: 34
error text: BadValue (integer parameter out of range for operation)
Received X11 Error:
error code: 2
request code: 154
minor code: 34
error text: BadValue (integer parameter out of range for operation)
Received X11 Error:
error code: 2
request code: 154
minor code: 34
error text: BadValue (integer parameter out of range for operation)
Received X11 Error:
error code: 2
request code: 154
minor code: 34
error text: BadValue (integer parameter out of range for operation)
Received X11 Error:
error code: 2
request code: 154
minor code: 34
error text: BadValue (integer parameter out of range for operation)
Received X11 Error:
error code: 2
request code: 154
minor code: 34
error text: BadValue (integer parameter out of range for operation)
Received X11 Error:
error code: 2
request code: 154
minor code: 34
error text: BadValue (integer parameter out of range for operation)
Writing: /tmp/blender.crash.txt
debug1: channel 1: FORCE input drain
Segmentation fault (core dumped)
debug1: channel 1: free: x11, nchannels 2
and no image is created.
Hopefully this explains my issue clearly. A few other things:
- There is a question here about Blender 2.8 and running remotely. However, I believe even though I am using ssh, the
-X
option should mean I have a display on my remote machine. Am I missing something? - There is another question about using Blender via ssh, and the answer seems to suggest X11 forwarding, which I think is what I am doing above.
- Another question/answer seems to offer an alternative to X11 forwarding, but I don't think this uses a Python script.
Is this error reproducible by others?
Let me know if any more information would be helpful.
UPDATE 1: I've reproduced the setup again, and here is the output in /tmp/blender.crash.txt
:
# Blender 2.80 (sub 74), Commit date: 2019-06-11 21:45, Hash d93a7290e506
# backtrace
blender(BLI_system_backtrace+0x1d) [0x13835ad]
blender() [0x1169ef9]
/lib/x86_64-linux-gnu/libc.so.6(+0x354b0) [0x7febe4c9b4b0]
blender(GHOST_ActivateOpenGLContext+0) [0x2f37960]
blender(DRW_opengl_context_create+0x3d) [0x2a38b2d]
blender(WM_init_opengl+0x20) [0x1541cc0]
blender(DRW_render_to_image+0x2fb) [0x2a39b2b]
blender(RE_engine_render+0x311) [0x1412751]
blender() [0x1413e21]
blender() [0x1416bc8]
blender(RE_RenderFrame+0x114) [0x1417554]
blender() [0x3ea66bb]
blender() [0x1532b7b]
blender(WM_operator_call_py+0x60) [0x1533370]
blender() [0x1409f33]
blender(_PyMethodDef_RawFastCallKeywords+0x2b9) [0x176be69]
blender(_PyCFunction_FastCallKeywords+0x25) [0x176bf25]
blender(_PyEval_EvalFrameDefault+0x7dd1) [0x1165011]
blender(_PyEval_EvalCodeWithName+0xae3) [0x1820233]
blender(_PyFunction_FastCallDict+0xb7) [0x176b6f7]
blender(_PyObject_Call_Prepend+0xbd) [0x176c9bd]
blender() [0x17c9d81]
blender(_PyObject_FastCallKeywords+0x104) [0x176c044]
blender(_PyEval_EvalFrameDefault+0x632a) [0x116356a]
blender(_PyEval_EvalCodeWithName+0xae3) [0x1820233]
blender(PyEval_EvalCodeEx+0x3e) [0x182038e]
blender(PyEval_EvalCode+0x1b) [0x18203bb]
blender(PyRun_FileExFlags+0xb2) [0x1853432]
blender() [0x13f5b61]
blender() [0x1168138]
blender(BLI_argsParse+0xd5) [0x133fb95]
blender(main+0x2c9) [0x10d01f9]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0) [0x7febe4c86830]
blender(_start+0x2a) [0x116680a]
UPDATE 2: Following this AskUbuntu question, I am reporting my OpenGL version on the remote machine directly after I log in via ssh -X machine
:
$ DISPLAY=:0
$ glxinfo | grep -i opengl
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: TITAN X (Pascal)/PCIe/SSE2
OpenGL core profile version string: 4.5.0 NVIDIA 390.87
OpenGL core profile shading language version string: 4.50 NVIDIA
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 4.6.0 NVIDIA 390.87
OpenGL shading language version string: 4.60 NVIDIA
OpenGL context flags: (none)
OpenGL profile mask: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 390.87
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
OpenGL ES profile extensions:
$
and
$ glxinfo | grep 'version'
server glx version string: 1.4
client glx version string: 1.4
GLX version: 1.4
OpenGL core profile version string: 4.5.0 NVIDIA 390.87
OpenGL core profile shading language version string: 4.50 NVIDIA
OpenGL version string: 4.6.0 NVIDIA 390.87
OpenGL shading language version string: 4.60 NVIDIA
OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 390.87
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
GL_EXT_shader_implicit_conversions, GL_EXT_shader_integer_mix,
$
And it seems to be up to date.
/tmp/blender.crash.txt
can tell us more. $\endgroup$/tmp/blender.crash.txt
file. $\endgroup$