Trouble building & using Blender as Python Module

Hi there, total n00b here. So, I’m on a MacOS M1, 64GB Ram machine running MacOS Monterey.

I was able to clone & build in both command-line & in Xcode. It opens and runs just fine!

However, my goal was to build the latest version of Blender-as-a-Python Module. I followed the steps, and it builds without error.

However, I have trouble once I try to actually use the result. I was able to build the python Wheel file and install it using Python 3.10.9 (via pyenv). That all worked fine.

But once I try to include it, I get a bunch of .dylib errors. Some of them, such as libtbb can be solved via brew installs. But eventually I figured out I could copy & paste all the *.dylib files from ~/blender-git/lib folder into a new /lib directory in the /bin folder, and it will work.

But then it says it cannot find bpy_types.

I’m probably doing a couple things stupid/wrong, but I recorded a video showing the exact problem:
(edit: link removed, no longer relevant)

The steps are too complicated to explain in text, so if you watch the video you can see exactly what I’m doing (and probably exactly what I’m doing wrong haha).

I’m trying to run the python test command from ~/blender-git/build_darwin_bpy/bin/ because that’s where the bpy/ folder ends up for inclusion. IDK if this is correct, either.

Anyway, please LMK what you think! Thanks -

  • Greg

P.S. I saw that other people had threads about building Blender on M1s and BPY, but none of them seem to help me or make sense for my problem.


Turns out the CMake steps specifically for bpy for MacOS were wrong. And fixed here:

So, I was able to compile 4.1.0 bpy and get it to work in a Python script after installing the python wheel.