I'd like to install some python modules which need to be compiled and use them in Blender. Usually I'd pip install them but that doesn't seem to be a possibility for Blender. I tried copying sys.path from my system python environment but it came up with quite a few errors.

The modules are cython and mdtraj - both are available using anaconda and pip but both need to be compiled for the python environment they're supposed to be run on.

So how should I go about installing/setting those up for use in Blender?


3 Answers 3


You need modules that work with the same Python version as the one shipped with blender (currently, blender 2.78 is shipped with Python 3.6.0).

My favorite Python distribution is anaconda. Here are the steps I just followed for blender 2.78 in linux (a similar setup should be easy to get for windows or macos).

  1. Install anaconda.
  2. Create an specific environment for the modules you need in blender:
conda create --name conda-python-blender python=3.6.0
  1. Activate this environment:
source activate conda-python-blender
  1. Install all your required libraries ("modules"):
conda install cython
  1. You can also use pip if your library is not (yet) in anaconda repositories:
pip install mdtraj
  1. Figure out the directory where your libraries are stored:
echo "import sys; print(sys.path)" | python

In my case, I get:

['', '/home/christophe/anaconda3/envs/conda-python-blender/lib/python36.zip', '/home/christophe/anaconda3/envs/conda-python-blender/lib/python3.6', '/home/christophe/anaconda3/envs/conda-python-blender/lib/python3.6/lib-dynload', '/home/christophe/anaconda3/envs/conda-python-blender/lib/python3.6/site-packages', '/home/christophe/anaconda3/envs/conda-python-blender/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg']

You want the "site-packages" directory, so, in my case:

  1. Open blender, then go to the Python console and do the following as Rich Colburn said, that is adding the previous directory the the path where Python is looking for libraries:
  import sys

And that's it!

  1. Optional step. If you want to make it permanent so that every time you open a new blender file, blender adds automatically the required directory to the path, then save the following lines in a file (say add-anaconda-libs-to-path.py) and put the file in ./scripts/startup/ (for me it is /home/christophe/.config/blender/2.78/scripts/startup/.
import sys
def register():
    print("Added anaconda library to path")

A final note: unless you want to update your libraries with conda, you don't have to activate the conda-python-blender environment anymore as blender will use its own Python interpreter.


Other answers manipulate the PATH and trick Python into detecting packages that were installed for another Python environment, this can lead to version errors, other problems and is ultimately a roundabout solution.

The most direct solution is to use python -m pip install <packages>, where python needs to be the Python executable that Blender comes installed with.

To detect the executable Blender uses, run the following code inside of Blender:

import sys; print(sys.executable)

Let's say that prints /usr/local/blender/bin/python then the complete command for installing numpy and scipy would be:

/usr/local/blender/bin/python -m pip install numpy scipy
  • $\begingroup$ Agree re not appending to path. IMO tho the accepted answer, ie up to making a virtual environment is the go. (doesn't have to be conda) Then start blender using that environment. by setting the BLENDER_SYSTEM_PYTHON environment variable, or starting via blender --env-system-python pointed at the venv. This way will have a vanilla blender python install to fall back to if things go awry... or for testing. . There are a number of questions here where using the method outlined in your answer has not worked $\endgroup$
    – batFINGER
    Commented Apr 9, 2021 at 18:03

I was able to get scipy to load just now by doing this:

import sys
import scipy

The site-packages is the folder containing the scipy folder

  • $\begingroup$ This works quite well provided conda python version is the same as python shipped with blender. For blender 2.78, be sure to install python 3.6.0 with conda. $\endgroup$
    – cjorssen
    Commented Mar 21, 2017 at 15:52

You must log in to answer this question.

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