I have been trying to get this to work for a couple days now. I have an EC2 P2 instance with NVIDIA CUDA configured by default, its a Deep learning Ubuntu AMI. This OS does not have a GUI so everything is via terminal.

I downloaded Blender's 2.8 TAR file for Linux and set it up on the EC2 instance. And ran the following command from the directory where the TAR file is extracted:

 ./blender -b -noaudio /home/ubuntu/file.blend --render-output . --engine BLENDER_EEVEE --render-format PNG --verbose 4

All I see in the output is this:

Blender 2.80 (sub 75) (hash f6cb5f54494e built 2019-07-29 17:17:04)
found bundled python: /mnt/blender/blender-2.80-linux-glibc217- 
Read blend: /home/ubuntu/file.blend

Blender quit

Don't know why its quitting but I am unable to debug this any further. Any help would be appreciated.

UPDATE: As per @rjg's recommendation, ran the following command:

./blender -b -noaudio /home/ubuntu/file.blend --render-output . --engine BLENDER_EEVEE --render-format PNG -f 1 --verbose 4

Got the following error:

Blender 2.80 (sub 75) (hash f6cb5f54494e built 2019-07-29 17:17:04)
found bundled python: /home/ubuntu/blender/blender-2.80-linux-glibc217- 
Read blend: /home/ubuntu/file.blend
Unable to open a display
Aborted (core dumped)

The actual problem is that Eevee does not support headless rendering.

Besides that the command misses a flag that tells Blender to render. Right now it will just open the userpref.blend with your settings and then close.

If you want to render the first frame, your command needs to contain -f 1.

blender -b -noaudio -E BLENDER_EEVEE -o . -F PNG -f 1

-f, --render-frame <frame>

Render frame and save it.

  • + start frame relative, - end frame relative.
  • A comma separated list of frames can also be used (no spaces).
  • A range of frames can be expressed using .. separator between the first and last frames (inclusive).

All flags can be found in Blender's manual.

  • $\begingroup$ this did not work. Updated OP with details. $\endgroup$ – sotn Sep 3 '19 at 12:32
  • $\begingroup$ @sotn Right, I forgot that headless rendering is not support with Eevee. Cycles should work though. $\endgroup$ – Robert Gützkow Sep 3 '19 at 12:36
  • $\begingroup$ you are right cycles worked. I will give VirtualGL a shot. $\endgroup$ – sotn Sep 4 '19 at 13:38
  • $\begingroup$ Developers are aware of the issue and this may get fixed in the future. See: developer.blender.org/T54638 $\endgroup$ – Robert Gützkow Oct 10 '19 at 17:44
  • $\begingroup$ According to this post by Paul Melis you can get it working by having a properly setup X server and OpenGL drivers: devtalk.blender.org/t/… $\endgroup$ – Robert Gützkow Nov 6 '19 at 17:26

As for headless render using EEVEE, you can fake a display:

!apt-get install python-opengl -y

!apt install xvfb -y

!pip install pyvirtualdisplay

!pip install piglet

from pyvirtualdisplay import Display

And you may not need piglet and xvfb, I have yet to test.

Source: Answer by Shrawan Agrawal https://stackoverflow.com/questions/50107530/how-to-render-openai-gym-in-google-colab


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.