I would like to run a fluid simulation on a headless Ubuntu machine I have lying around. I did manage to find a bug report on the issue but to no avail. Has anyone else had any success? Or perhaps a better solution to my problem?

  • $\begingroup$ Seems not to work for 2.69 and 2.70a. Only an issue on Windows 8.1 (64bit i5 mobile) No Problem on Linux (Ubuntu 12 and 14) Posted a comment here: developer.blender.org/T28725 regards, F99 (edit:) ok, the essence of the post is, the operator bpy.ops.fluid.bake() is simply not working. It returns "finished", but the bake is NOT started at all. $\endgroup$
    – user3423
    May 9, 2014 at 11:08
  • $\begingroup$ I am trying Brecth's method, but failed with a continuous series of errors that read as below: PyContext 'screen' not found PyContext 'screen' not found PyContext 'area' not found PyContext 'blend_data' not found PyContext 'region' not found PyContext 'area' not found It seems that I need to indicate what is the "active object", then "scene" and so on... Did anyone manage to perform a simulation via the command line? Thanks, Diego $\endgroup$
    – user13796
    Apr 16, 2015 at 3:59
  • $\begingroup$ Works fine for me.. Is it possible you could upload a file where it doesn't work? $\endgroup$
    – gandalf3
    Apr 16, 2015 at 4:07
  • $\begingroup$ How do I upload a file here? $\endgroup$
    – user13796
    Apr 16, 2015 at 4:11
  • $\begingroup$ You can't upload .blends directly to SE at this time, but pasteall is a good blender-specific option for temporary usage. For more permanent storage, there's blend-exchange $\endgroup$
    – gandalf3
    Apr 16, 2015 at 4:14

1 Answer 1


It's a bit more complicated than it could be because fluid simulating baking is only exposed as an operator. That means it expects an active object in the context, which is usually provided by the user interface that is not available in background mode.

It is possible to pass this object to the operator manually however. The following is an example script that bakes all fluid domain objects in all scenes:

import bpy

for scene in bpy.data.scenes:
    for object in scene.objects:
        for modifier in object.modifiers:
            if modifier.type == 'FLUID_SIMULATION':
                if modifier.settings.type == 'DOMAIN':
                    bpy.ops.fluid.bake({'scene': scene, 'active_object': object})

This works when executed from the command line with a command like this:

blender --background file.blend --python script.py
  • $\begingroup$ Just out of curiosity, are you Brecht van Lommel, the Cycle Developer? $\endgroup$ Jun 10, 2013 at 5:17
  • 11
    $\begingroup$ Yes, that's me. $\endgroup$
    – brecht
    Jun 10, 2013 at 18:12
  • $\begingroup$ This answer just made my day - only the co-producer of Blender could figure out how to bake fluids. $\endgroup$ Aug 22, 2015 at 17:54
  • 1
    $\begingroup$ Does this mean we can in fact bake multiple domains with one command? The UI complains when there are multiple domain objects $\endgroup$ Nov 5, 2017 at 0:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .