Building python module on Windows for Linux


I have now successfully managed to compile Blender 3.2 on my Windows computer as a Python module. But I would like to use the Python module on my Linux server as well.

As I understand it, I need the instead of the bpy.pyd, is that correct? If so, can I also compile a Python module with my Windows computer that is usable for Linux?

Thanks a lot!

I could be wrong but my understanding is that bpy isn’t like traditional python modules and can’t do that. It’s system specific and needs to be compiled with CMake on your OS. Would be really handy to just pip install bpy3.2 though, maybe one day.

No it would have to be build on linux

I assumed it already. But that’s fine. I created a VM with Ubuntu 20.04 and I was able to compile it without any errors. I went with the precompiled library “linux_centos7_x86_64”.

Unfortunately I am getting an error if I test the script with:

/home/<user>/blender-git/lib/linux_centos7_x86_64/python/bin/python3.10" -c "import bpy; bpy.ops.render.render(write_still=True)

Unable to open a display

Of course it cannot open a display because I am using a headless Ubuntu version. But I don’t need any GUI. How can I fix that?


This solved my problem: python - Render using a blender script in google colab - Stack Overflow