There are informations on how to build a bpy python module from blender source but, it does not work (for me) using Ubuntu x64 16.04LTS.

We need a working guidance !?

Building it up with: https://wiki.blender.org/index.php/Dev:Doc/Building_Blender/Linux/Ubuntu/CMake

but use

sudo ./blender/build_files/build_environment/install_deps.sh

...and at the end:

cd ~/blender-git/blender
make bpy

or: different cmake config: https://wiki.blender.org/index.php/User:Ideasman42/BlenderAsPyModule


  • building blender bin is fine out of the box.
  • but make configs and also "make bpy" throws errors:

    requires dynamic R_X86_64_32 reloc which may overflow at runtime; recompile with -fPIC

some solution for this is to:


build up python on your own with "enable-shared" and copy over libpython3.6m.a

sudo apt install build-essential checkinstall
sudo apt install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tar.xz
tar xvf Python-3.6.0.tar.xz
cd Python-3.6.0/
./configure --enable-shared
sudo make altinstall

and copy over libpython3.6m.a from /usr/local/lib/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6m.a to /opt/lib/python-3.6/lib

BUT the main problem is

sudo ./blender/build_files/build_environment/install_deps.sh

which should behave the way to build python with fPIC right away !


Answered from blendercoders chat: There is a pending fix for it: https://developer.blender.org/D3078 But not in master today.


Question: Is it the purpose not to include folder "2.79" on "make bpy" so there are files missing -- compared to the ^^Ideasman42 config, is there a pending fix or is that "working as designed" - could it be made better!?

  • $\begingroup$ Where did you get the sources? How did you try to build Blender? $\endgroup$ – dr. Sybren Mar 12 '18 at 10:07
  • $\begingroup$ I followed the discription on: wiki.blender.org/index.php/Dev:Doc/Building_Blender/Linux/… ..... ./blender/build_files/build_environment/install_deps.sh $\endgroup$ – sonicdee Mar 12 '18 at 10:42
  • $\begingroup$ That page doesn't describe where to get the sources from. Did you use Git? Which revision/branch did you check out? Add this to your question, so that it's clear in one read for others, without having to require them to read through all the comments. $\endgroup$ – dr. Sybren Mar 12 '18 at 10:45
  • $\begingroup$ as first point says, I used: git clone git.blender.org/blender.git ..and.. git submodule update --init --recursive ..and.. git submodule foreach git checkout master ..and.. git submodule foreach git pull --rebase origin master $\endgroup$ – sonicdee Mar 12 '18 at 10:51
  • $\begingroup$ ..on the error on top - I tried the way to set up pyenv as alexlee posted gist.github.com/alexlee-gk/… but It does not work better I get the "relocation R_386_GOTOFF" errors, still I'ts not out of the box or should it do build up with "make bpy" ? - as I'm not familar on the dependencies and building stuff, It may be worse now ... trying fresh $\endgroup$ – sonicdee Mar 12 '18 at 11:20

This issue should be fixed by commit 0a02c288aa258e18d19eff0be984f214d556b159


"install_deps: Enable PIC in Python static library."

I was discussed here: https://developer.blender.org/D7177

Also similar question here:



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.