Besides installing it, there is nothing you have to do with CMake when doing the easy build.
Your second link points to https://wiki.blender.org/wiki/Building_Blender/Linux/Ubuntu#Automatic_Dependency_Installation which is under Advanced Setup. The easy build steps are above this. Since you linked to the Advanced Setup, are you sure you did the Easy Build?
Alright i followed the easy step, am asking do i have to do the copy to path also?,
it says blender installed succesfully but when i go into python and type import bpy i ge no module named bpy, how to i complete this step so that i can have bpy as a python module.
Are the python used for building bpy and the one you run to type import bpy the same ?
Also, in output of make bpy, you’ll see the location where the bpy.so was installed into.
Thank you very much for your response, you are getting to the point,
this part is exacly where a confused and i dont understand, currently am on google cloud/aws ubuntu instance, i did not install python it came installed with python3 so i just start the process of the blender installation , yes i saw the bpy.so, do i have to move it or do something with it?
your response is highly appreciated, i have been trying to work on this for 2 weeks, because we couldnt use bpy in our server without calling the subprocess and we want to elimnate this.
make bpy loads build_files/cmake/config/bpy_module.cmake which sets WITH_INSTALL_PORTABLE to off. that means bpy.so would be installed in the site packages of the python used during build process. (it’s printed in the cmake output). If it was on, bpy.so would remain in the build folder and you would have to do
import sys
sys.path.append("path to folder where bpy.so is present")
before importing bpy.
Check the contents of site-packages, write permissions of the same. If it’s there, importing it using the same python binary wouldn’t be a problem. To ease all this, one can also run ctest -VV in the build folder. that’ll try to import bpy and see if it succeeds. (assuming master branch is being built)
– Configuring done
– Generating done
– Build files have been written to: /home/swissbobo/blender-git/build_linux_bpy
Building Blender …
make -s -C “/home/swissbobo/blender-git/build_linux_bpy” -j 8 install
and here is the end of the make bpy
edit build configuration with: /home/swissbobo/blender-git/build_linux_bpy/CMakeCache.txt run make again to rebuild
.
Blender successfully built, run from: /home/swissbobo/blender-git/build_linux_bpy/bin/blender
now before i go to the make install part,
do i need to do anything again? or just follow the instruction that says
Linux
System Wide Install
You may want to copy into the module to the systems Python path, e.g.:
/usr/lib/python3.7/site-packages
For a system wide installation:
WITH_INSTALL_PORTABLE=OFF
Note, PYTHON_SITE_PACKAGES will be used as the target path, but this is auto detected, nevertheless, you may want to modify.
Once these options are set, from the BPY build directory (build_linux_bpy/ by default) run:
make install.
i will wait for response before running this process thank you very much.
here i ran from the folder below but i get this errors
/blender-git/build_linux_bpy/bin$ python3
Python 3.9.5 (default, May 11 2021, 08:20:37)
[GCC 10.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import bpy
Color management: using fallback mode for management
Color management: Error could not find role data role.
Color management: scene view "Filmic" not found, setting default "Standard".
blf_load_font_default: 'fonts' data path not found for 'droidsans.ttf', will not be able to display text
blf_load_font_default: 'fonts' data path not found for 'bmonofont-i18n.ttf', will not be able to display text
blf_load_font_default: 'fonts' data path not found for 'bmonofont-i18n.ttf', will not be able to display text
/run/user/1001/gvfs/ non-existent directory
bpy: couldn't find 'scripts/modules', blender probably won't start.
Freestyle: couldn't find 'scripts/freestyle/modules', Freestyle won't work properly.
ModuleNotFoundError: No module named 'bpy_types'
ModuleNotFoundError: No module named 'bpy_types'
ERROR (bpy.rna): source/blender/python/intern/bpy_rna.c:7378 pyrna_srna_ExternalType: fa
I wasn’t sure if installation is done by make bpy or not. If that step is pending, yes it should be done.
cmake --build /home/swissbobo/blender-git/build_linux_bpy --target install
or in build folder make install -j 4.
The error in your next comment indicates that the Resources folder either doesn’t exist or doesn’t have the fonts, scripts etc. The directory structure in bpy should be the same as Blender app and its fonts folder.
before make install i did this WITH_INSTALL_PORTABLE=OFF
now the only time am able to get close to importing bpy which ends up with python crashing or quitting is inside
only from here when i time python3
and inside the pythong shell
>>> import bpy
>>>
>>> import bpy
Color management: using fallback mode for management
Color management: Error could not find role data role.
Color management: scene view "Filmic" not found, setting default "Standard".
blf_load_font_default: 'fonts' data path not found for 'droidsans.ttf', will not be able to display text
blf_load_font_default: 'fonts' data path not found for 'bmonofont-i18n.ttf', will not be able to display text
blf_load_font_default: 'fonts' data path not found for 'bmonofont-i18n.ttf', will not be able to display text
/run/user/1001/gvfs/ non-existent directory
bpy: couldn't find 'scripts/modules', blender probably won't start.
Freestyle: couldn't find 'scripts/freestyle/modules', Freestyle won't work properly.
ModuleNotFoundError: No module named 'bpy_types'
ModuleNotFoundError: No module named 'bpy_types'
ERROR (bpy.rna): source/blender/python/intern/bpy_rna.c:7378 pyrna_srna_ExternalType: failed to find 'bpy_types' module
You’re mixing non-portable builds in python site packages and the bpy.so in the build folder. Need to pick one. Try running python -c "import bpy" in a folder other than the bin. I added a point in the troubleshooting section: Building Blender/Other/BlenderAsPyModule - Blender Developer Wiki
There is one thing about building Blender as a Python module that I don’t like. Namely, doing an import bpy magically makes the other modules (e.g. mathutils) available for subsequent import. Normal Python libraries would, say, put all these modules in their own package. If this were called blender, then you could instead write more normal-looking code like
from blender import bpy
from blender import mathutils
and there would be no magical namespace shenanigans going on.
Quick update:
As per logs I asked for in a DM Pasteall/jQv5 (Python), SVN libdir python is selected by Blender and that’s where the installation of bpy happens. When python -c "import bpy" is run, it picks system Python which causes the error.
Discussed it with Campbell, and agreed upon using system Python for bpy instead of libdir one. I don’t have the platform where I can test this, would have to wait for a linux user to create a patch.