Blender player is a nice way to create stand alone .blend files that can be distributed to other people.

However, for most interesting programming, one would use in python libraries such as numpy, etc. All the python libraries out there is what makes python so powerful. Blender does not come with e.g. numpy pre-installed, .but 3rd party libraries can be installed.

However, when the .blend file is distributed, it still depends on those libraries... The problem is that now the end-user, which might not be tech-savvy needs to install the 3rd party libraries alone... Is there any way to fix this?

This question relates to the (unanswered :S) How to bundle python libraries into addon? in that a solution to it might be a solution to this one, but "how-to-bundle-python-libraries-into-addon" refers to plugins, not .blends for the standalone player, and further this question is more general, any way to distribute the 3rd-party libraries would be ok (e.g. could one put them in the .blend directory and set some paths to point there?).

I had the problem on a .blend file, and that was because I was using an old version of Blender , newer versions will have numpy etc. (my old version was using the system's python, now python comes with a nice python that has common stuff like numpy included, so the question becomes less important.

To see if numpy was not there i did on a script from inside blender:

import os
import sys
print ('sys.executable',sys.executable)
print ('---')
print ('sys.path',sys.path)
print ('===')
    print ('PYTHONPATH', os.environ['PYTHONPATH'])
    print ('no PYTHONPATH')
import numpy as np

to which I got:

sys.executable /usr/bin/blender
sys.path ['/usr/share/blender/scripts/addons', '/usr/share/blender/scripts/startup', '/usr/share/blender/scripts/modules', '/usr/lib/python35.zip', '/usr/lib/python3.5', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/usr/lib/python3.5/lib-dynload', '/usr/local/lib/python3.5/dist-packages', '/usr/lib/python3/dist-packages', '/usr/share/blender/scripts/freestyle/modules', '/usr/share/blender/scripts/addons/modules', '/home/ntg/.config/blender/2.76/scripts/addons/modules']
Traceback (most recent call last):
  File "/Text", line 11, in <module>
ImportError: No module named 'numpy'
Error: Python script fail, look in the console for now...


Blender 2.79 gives:

sys.executable /home/ntg/software/blender-2.79-linux-glibc219-x86_64/blender
os.path: /opt/pub/anaconda2/bin:/home/ntg/bin:/home/ntg/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

1 Answer 1


Blender does not come with e.g. numpy pre-installed

Yes it does, unless you configure WITH_PYTHON_INSTALL_NUMPY:BOOL=OFF and build it yourself.

Python modules can simply be imported from whatever is listed on the PYTHONPATH environment variable. If it doesn't automatically work by placing .py files next to your .blend file, you can modify PYTHONPATH to point to that location.

You can bundle 3rd-party modules with your game, but you do have to think about the following:

  • You have to adhere to the license of the module, so probably you'll have to include their license, give them credit, etc.
  • Be careful with binary modules. Make sure you test (so don't read documentation and assume it'll work, but actually test it) that they work with the version of Python that's built into Blender. On Windows this may be an issue, since (AFAIK) we build Python with different options than the python.org build, and as a result the pre-built binary Python modules may not load in Blender.
  • If you do decide to use binary (i.e. .pyd, .so, or .dll extensions) Python modules, make sure you include the versions for all platforms you want your game to run on.
  • $\begingroup$ Thanx for the answer! In my system (sonya mint 18.2, Blender 2.76b), it seems numpy is not there(will add info to the question), however the PYTHONPATH might solve the problem, will have to check and be back $\endgroup$
    – ntg
    Nov 20, 2017 at 10:27
  • 1
    $\begingroup$ Try a recent Blender release from download.blender.org/release; the version of Blender you're using now is already two years old. $\endgroup$
    – dr. Sybren
    Nov 20, 2017 at 11:42
  • $\begingroup$ Lol, and It is the one that comes with the latest version of ubuntu :) Good point, will do. $\endgroup$
    – ntg
    Nov 20, 2017 at 13:19
  • 1
    $\begingroup$ Indeed! Using the latest version of blender (2.79) allows me to load numpy! Still not sure what happens if there is some obscure library I need, but my problem is solved :) (thanx, did +1) $\endgroup$
    – ntg
    Nov 20, 2017 at 13:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .