Unable to build blender


I am trying to build blender so that I can use it directly from python and was going through this tutorial and I got stuck on the very first make command giving me

CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:108 (message):
  Could NOT find PythonLibsUnix (missing: PYTHON_LIBRARY PYTHON_LIBPATH

I am using Ubuntu 14.04, with the system python installs (3.4.3 and 2.7.6). I am expected to specify manually these environment variables (if they are that)? Or it’s something else? If the former, what are the standard paths for these?

Asked By: fbence



Maybe you are missing the python development libraries

apt-get install python-dev


Answered By: Sam F

If it isn’t finding the python files then you will need to tell it where they are.

If you have checked out the current master then it would be looking for python 3.5 as this has recently been setup to be the default for the next release, you can still set it to 3.4 for now as I don’t think any 3.5 specific code changes have happened yet. If you downloaded a release tarball then it should be looking for 3.4 (unless you have an older source copy)

Answered By: sambler

This will solve your issue

sudo apt-get build-dep  blender

similar compile time dependency problems for other applications can be solved by doing this build-dep trick

By cherry picking from the list of packages above cmd wants to install, you probably need just these :

sudo apt-get install libpython3-dev libpython3.4-dev

although allowing the build-dep cmd to run will jack up otherwise disabled features you may want in blender


Answered By: Scott Stensland

For compilation, you have to point to Python3:

cmake -DPYTHON_LIBRARY=/usr/bin/python3.4m -DPYTHON_INCLUDE_DIR=/usr/include/python3.4m ..
Answered By: Miro Iliaš

this website
claims that the following syntax will "re-define [all PYTHON_* variables] based on your Python prefix"

cmake ./ ../blender -U PYTHON* -D PYTHON_ROOT_DIR=/opt/my_python

and i think this should be the equivalent of passing these settings into blender 3.0’s makefile

BUILD_CMAKE_ARGS=-U PYTHON* -D PYTHON_ROOT_DIR=$PWD/my-path-to/Python-3.9.9/ make

but i still get

CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
  Could NOT find PythonLibsUnix (missing: PYTHON_LIBRARY PYTHON_INCLUDE_DIR

so idk, maybe this is an obsolete doc

Answered By: ThorSummoner

My distro ( Devuan ) doesn’t yet offer python3.10. I compiled and installed it in a custom directory so as not to affect existing python installations.

Find the python version you need and download it from

Expand it in a working directory ( ok to delete later ):

tar -xf Python-3.10.8.tgz
cd Python-3.10.8

now configure python to build with custom paths ( here I’m using ~/blenderpython )

export set BLENDERPYTHONDIR=/home/`whoami`/blenderpython

./configure --enable-optimizations --prefix=$BLENDERPYTHONDIR
make -j 4 
make install

Add required packages:

./pip3 install numpy;
./pip3 install requests;
./pip3 install zstandard;
./pip3 install cython;
./pip3 -vvv list   # to see installed and where.
# i.e. all installed in ~/blenderpython/lib/python3.10/site-packages

Now go to your blender source.. in home dir?

cd ~/blender-git/blender/

and try building again specifying your new python


note there are two backslashed spaces in the command above.

note PYTHON_EXECUTABLE and PYTHON_LIBRARY point to files. PYTHON_INCLUDE_DIR points to… a dir.

Answered By: JJones