Install Blender as Python Module

I have successfully built Blender as a Python Module using cmake on Ubuntu 20.04. I want to install it into my Python to use Eclipse as the IDE/Debugger (did this on Windows 10 to great fanfare). Problem is that Blender is Python 3.7.7 and the version installed for Ubuntu in .local/bin/Python is 3.8. As far as I am aware, this won’t work. They need to be the same version, correct?

  1. What do I do about this? Should I downgrade my installed Python version or install the older version separately (making it default - PYTHONPATH, etc.)?

  2. wiki.Blender.orgs instructions for installing the Blender Python Module on Linux don’t make sense to me. It says to use ‘make install’ but you have to set:

WITH_INSTALL_PORTABLE=ON
CMAKE_INSTALL_PREFIX=$HOME/.local/lib/python3.7/site-packages

for a local install (just for me, the user, in my Home directory). How do you set these? Can it be done in the terminal as arguments to ‘make install’ or is there a file that needs to be updated?

I do not want to continue this process until there is clarification about these 2 areas of ignorance or possible incompatibility.

Thanks!
Robert

Run the following in the build directory you made to build bpy.

cmake -S ../blender -B . -C ../build_files/cmake/config/bpy_module.cmake -DWITH_INSTALL_PORTABLE=ON -DCMAKE_INSTALL_PREFIX="$HOME/.local/lib/python3.7/site-packages"
make install

If you install bpy to the path above, i.e., with python 3.7, would simply changing python interpreter in eclipse allow you to use bpy?
If build process is affected by available python version, isn’t correct python version shipped in linux_centos7_x86_64 ?


This post has working docker files though.

1 Like

Curious, did you have issues using them?

I was able to produce output from the dockerfiles as-posted after the fix so I would be quite surprised indeed to learn that someone was having issues with them, but I would also want to fix it right away!

I’ve never compiled bpy. The TM was not a jab, but since if it comes across that way, will remove it.

No it’s fine I was just checking is all.