After sudo apt-get install blender on Ubuntu 12.10, I have Blender version 2.63

However, I can not import the relevant scripting Library

Python 3.2.3 (default, Sep 25 2013, 19:36:10) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import bpy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named bpy
>>> import Blender
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named Blender

Later on, I would like to use numPy and Blender to create some figures for 3D printing, as a friend has suggested.


4 Answers 4


bpy is only available when a script is being run from the Python interpreter in Blender. You can't access it from an external interpreter. The bpy module itself is located in the Python environment supplied with Blender (if you download the zip-file, rather than the installer).

To use the bpy module, open the script in Blender's Script Editor.

  • 3
    $\begingroup$ Well, does exist a coomand line to launche blender script editor then "paste" or "run" any other script then export?. I mean without use GUI/X and of course, without the "experimental" blender as python module. Maybe the answer is " the experimental " but, i must ask. thx. $\endgroup$
    – m3nda
    Commented Sep 6, 2016 at 13:41
  • $\begingroup$ I realize this is old, but to for anyone else with the same question as @m3nda: You can run blender in a GUI-less mode and excecute your python script via: blender --background --python my_script.py -- my_argument1 my_argument or similar. $\endgroup$ Commented Mar 28, 2022 at 7:31

As far as I know, this can't be done straight forwardly.

But, there is an experimental feature you can try. Basically you build a Blender with some special CMAKE settings. Here is the complete "HowTo" (from @Ideasman): Blender as a Python Module.

Also notice that Blender (currently) works with python 3.3.

  • $\begingroup$ That is interesting. I should try it out sometime. $\endgroup$
    – user877329
    Commented Jul 7, 2016 at 7:19
  • $\begingroup$ really interesting ... exporting 3d models as scripts, so you can easily modify some parts before rendering/exporting. $\endgroup$
    – m3nda
    Commented Sep 6, 2016 at 13:39
  • $\begingroup$ the link is broken, is there any chance you can update? $\endgroup$
    – Nick Brady
    Commented Sep 18, 2019 at 12:16
  • $\begingroup$ Sorry, the page is gone (certainly with the rise of Blender 2.8). But you may find something interresting in there : pypi.org/project/bpy (I haven't tried it BTW). $\endgroup$
    – Polosson
    Commented Sep 19, 2019 at 13:21

The bpy module is only accessible from the Python interpreter built-in to Blender. It is tightly integrated to Blender's runtime process, and is not primarily meant to be accessed like a library from a standalone Python process.


You can use fake-bpy-module instead.

From the description of the repo:

fake-bpy-module is the collections of the fake Blender Python API modules for the code completion in commonly used IDEs.


You must log in to answer this question.

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