[Bf-committers] Issues with building blender as a python module on Linux
Alex Delgado
alexdel247 at gmail.com
Tue Sep 10 22:01:17 CEST 2019
Hi,
I am not sure if this is the best place to ask this question, but I have
been trying to build blender as a python module on my Linux (Debian
GNU/Linux 9.9) virtual machine, and I have been having a lot of trouble.
I have followed this instructions:
https://wiki.blender.org/wiki/Building_Blender/Linux/Ubuntu
https://blender.stackexchange.com/questions/126959/how-to-build-blender-as-python-module
and have tried with different versions of Blender (2.81 and 2.79) and with
different variations in step 2 of installing the dependencies such
as install_deps.sh --skip-python --skip-numpy.
In step 3 (Compiling blender with CMake) I run the below command in cd
~/blender-git/blender
instead of just make. These parameters(except for the ones in blue, is what
the output told be to do after running install_deps.sh .
sudo make bpy -j2 BUILD_CMAKE_ARGS="-U *SNDFILE* -U *PYTHON* -U *BOOST*
-U *Boost* -U *OPENCOLORIO* -U *OPENEXR* -U *OPENIMAGEIO* -U *LLVM* -U
*CYCLES* -U *OPENSUBDIV* -U *OPENVDB* -U *COLLADA* -U *FFMPEG* -U *ALEMBIC*
-D WITH_CODEC_SNDFILE=ON -D PYTHON_VERSION=3.5 -D WITH_OPENCOLORIO=ON -D
OPENCOLORIO_ROOT_DIR=/opt/lib/ocio -D WITH_OPENIMAGEIO=ON -D
OPENIMAGEIO_ROOT_DIR=/opt/lib/oiio -D WITH_CYCLES_OSL=ON -D WITH_LLVM=ON -D
LLVM_VERSION=3.4 -D *WITH_PYTHON_INSTALL=OFF -D WITH_PYTHON_MODULE=ON* -D
OSL_ROOT_DIR=/opt/lib/osl -D LLVM_ROOT_DIR=/opt/lib/llvm -D LLVM_STATIC=ON
-D WITH_OPENSUBDIV=ON -D OPENSUBDIV_ROOT_DIR=/opt/lib/osd -D
WITH_OPENVDB=ON -D WITH_OPENVDB_BLOSC=ON -D WITH_ALEMBIC=ON -D
ALEMBIC_ROOT_DIR=/opt/lib/alembic -D WITH_CODEC_FFMPEG=ON -D
FFMPEG_LIBRARIES='avformat;avcodec;avutil;avdevice;swscale;swresample;lzma;rt;theora;theoradec;theoraenc;vorbis;vorbisenc;vorbisfile;ogg;x264'"
After this step, I get a message that blender was successfully built, but
then after trying to import bpy, after typing python3 or python in the
Linux command like I get this error:
>>> import bpyTraceback (most recent call last): File "<stdin>", line 1, in
<module> File
"/home/username/blender-git/build_linux_bpy/bin/2.79/scripts/modules/bpy/__init__.py",
line 38, in <module> from _bpy import types, props, app, data,
contextModuleNotFoundError:
No module named '_bpy'
This is after adding this to my Pythonpath:
export
PYTHONPATH=$PYTHONPATH:/home/username/blender-git/build_linux_bpy/bin/2.79/scripts/modules:/home/username/blender-git/build_linux_bpy/bin/2.79/scripts/modules/bpy
I take the error above to mean that it is trying to run it as an internal
blender C module according to this post .
https://stackoverflow.com/questions/37187025/blender-python-bpy-init-py-apparently-importing-from-a-non-existent-mod
My question is what am I missing here to make this work? Is there a
parameter that I am missing when running sudo make bpy? Do I need to do
something different in the Pythonpath? Do I need to have a specific version
of python in order for this to work? (I have 2.7 and 3.7 that came from the
anaconda package).
About two years ago I was able to successfully build blender 2.78 as a
python module in my windows machine and use it directly from my python
interpreter in eclipse. I remember the process being tedious as well, but
this time I feel like I have exhausted all the answers from the internet.
If anyone has successfully build blender as a python module on linux, and
has ran into similar issues as mine and could point me to what I am doing
wrong I will greatly appreciate it.
Thanks,
Alex
More information about the Bf-committers
mailing list