"Unable to open a display" when rendering with Eevee
mrgunior opened this issue ยท 6 comments
Hi,
So I've been working lately on my own Dockerfile trying to get blender setup in a container. I was successful to get it containerized, but I noticed that when I entered my container to render my Monkey.blend file using this command blender --background Monkey.blend --render-output /tmp --render-frame 1
it gave me the following error:
Blender 2.82 (sub 7) (hash 375c7dc4caf4 built 2020-03-12 05:30:40)
AL lib: (EE) ALCplaybackOSS_open: Could not open /dev/dsp: No such file or directory
found bundled python: /usr/bin/blender-2.82a-linux64/2.82/python
Read blend: /usr/bin/blender-2.82a-linux64/Monkey.blend
Unable to open a display
Aborted (core dumped)
So I thought maybe my Dockerfile was faulty, so I gave this repo (nytimes) a try, specifically this Dockerfile.
Build command I used: docker build -t nytimes .
Run command I used: docker run -d -t --name nytimes.container nytimes
Afterwards I saw that it was running, so I then entered the container with docker exec -it nytimes.container /bin/bash
I then proceeded to use the following command to render my Monkey.blend (as a test) that I copied to the /tmp folder in the container.
blender --background /tmp/Monkey.blend --render-output /tmp --render-frame 1
But I receive the same error as my other container.
Blender 2.82 (sub 7) (hash 77d23b0bd76f built 2020-02-12 17:14:50)
AL lib: (EE) ALCplaybackOSS_open: Could not open /dev/dsp: No such file or directory
found bundled python: /bin/2.82/python
Read blend: /tmp/Monkey.blend
Unable to open a display
Aborted (core dumped)
Clearly I'm doing something wrong, or misunderstand how I need to correctly use the container. I double checked the /tmp folder but nothing was present in it, only the Monkey.blend file.
What is the correct way of doing this?
System & version:
host OS Ubuntu 18.04
Docker engine 19.03.8
Hi @mrgunior ๐ thanks for the details!
The problem here is your scene is trying to render using Eevee which relies on OpenGL being present (The actual error that breaks it is Unable to open a display
). The two options you can go about are either to mount your local graphics device to the container (as discussed in #3) or to switch to rendering using Cycles which can be done by running a command like:
blender --background /tmp/Monkey.blend --render-output /tmp -E CYCLES --render-frame 1
Can you try running this to see if works on your machine?
Hi @mrgunior thanks for the details!
The problem here is your scene is trying to render using Eevee which relies on OpenGL being present (The actual error that breaks it is
Unable to open a display
). The two options you can go about are either to mount your local graphics device to the container (as discussed in #3) or to switch to rendering using Cycles which can be done by running a command like:blender --background /tmp/Monkey.blend --render-output /tmp -E CYCLES --render-frame 1
Can you try running this to see if works on your machine?
Hi I'll give it a try! thanks for your quick reply
I have to say thank you so much for you help
Running this command blender --background /tmp/Monkey.blend --render-output /tmp -E CYCLES --render-frame 1
shows my original docker image works perfectly (and yours).
I sadly only have a CPU currently, so I assume running something similar to #3 would make Eevee work? If so I'll have a whack at it and if not where can I ask for more details?
Happy to hear it solved it ๐
Yes, you can try mounting your device as detailed here to use Eevee or alternatively switch to using Cycles.
Closing this issue as it seems to work now, but feel free to re-open/open a new issue if something isn't working for you.
Update on this for Blender 3+:
Recently, I ran into the same issue when I experimented with a Raspberry Pi and Blender 3 from Arch AUR (Arm version).
Long story short: there are two approaches that you can take:
(and btw @mrgunior & @juniorxsound : you will run into the same problem even with Cycles in case you have OpenGL elements in your scene, i. e. grease pencil, so this is only a partial and limiting workaround)
-
you can set the DISPLAY variable before running Blender in headless mode like so:
DISPLAY=:0 blender --background /tmp/Monkey.blend --render-output /tmp --render-frame 1
-
you could use
xvfb
(https://en.wikipedia.org/wiki/Xvfb) like so:
xvfb-run --auto-display blender --background /tmp/Monkey.blend --render-output /tmp --render-frame 1
however, render farms might have problems with monitoring the spawned process which in this case isxvfb-run
instead ofblender
(AcademySoftwareFoundation/OpenCue#1212)