MacOSX Build Blender as Python module install instructions still incorrect

On the Blender wiki page about building Blender as a Python module there is an incorrect statement about the install location of the 2.81 directory.

See here: OSX install steps

It says to copy the 2.81 directory into site-packages. But really the directory is expected in Resources, based on my experience.

See here: source code

Is there any chance to update the wiki to reflect this? Am I just building the Python module wrong?

Thanks in advance!

I’ve updated the wiki page now to reflect this.

These directories are all a bit arbitrary since it’s matching what happens inside the Blender.app which doesn’t make that much sense for a Python module.

I filed an issue here though I am really not sure how to go about committing that change since the reception of Blender as a python module hasn’t really been warm for me when I bring up ways that bpy.so breaks the mold for the current build system.

To contribute code, submit it here:
https://developer.blender.org/differential/diff/create/

I think the proper solution requires some bigger changes, for all platforms. It doesn’t make much sense to me to have a 2.83 folder in site-packages, or to have it directly in C:\Python37\ on Windows. Perhaps there can be a bpy folder in site-packages that contains both the module and 2.83 folder.

Maybe it’s worth noting (maybe it isn’t, too) when I add the 2.82 directory to to the list of scripts to be added to a Python wheel and build it, that installing from that wheel results in the following environments:

Windows (system install)

/DLLs
/Doc
/include
/Lib
 ---- ...
 ---- /site-packages
       ---- /bpy
/libs
/Scripts
 ---- 2.82
/tcl
/Tools
LICENSE.txt
NEWS.txt
python.exe
python3.dll
python38.dll
pythonw.exe
vcruntime140.dll

Windows (venv install)

/Include
/Lib
 ---- /site-packages
       ---- /bpy
/man
/Scripts
---- 2.82
---- python.exe
pip-selfcheck.json
pyvenv.cfg

Linux & MacOSX

/bin
---- 2.82
---- python3
/lib
---- /site-packages
      ----- /bpy

None of the above actually work in practice though for the obvious reasons…

FWIW (not much) but it would be my preference that much further down the line, one of two things happen:

  • bpy's set of additional scripts (the 2.82 folder) become part of package_data

    • Retrieving package_data is handled by Python to my knowledge: pkg_util.get_data() or something like
  • bpy's set of additional scripts becomes part of bpy itself, all addons are part of Blender’s site-packages folder to be installed by Blender through a modern package manager (like pip, or even I would go so far as to say it should be pip)

This is purely my preference and I have no idea what the plans are for Blender but I heard that 3.0 would be a Python package somewhere so I think it’s important to put out some considerations for what that means since currently the OS implications of bpy.so/.pyd are huge even though Python in and of itself is meant to be platform agnostic to a degree.

The forced hard coded path really makes the installation platform dependent.

There are no plans to make Blender 3.0 a Python package, or to move in that direction by e.g. making add-ons pip packages.

1 Like