TransWikia.com

How can I use blender's python API from a Ipython terminal or Jupyter Notebook?

Blender Asked by Ryu S. on January 30, 2021

I would like to have a python notebook running on my localhost:8000 that i can execute bpy scripts with… and see the resulting change in my other monitor which is running blender.

Normally, I would have to import a script into the “Scripting – TextEditor” view and hit “run script”. Is there a way to bypass this interface?

2 Answers

You can install fake-bpy:

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

pip install fake-bpy-module-<version>

for example:

pip install fake-bpy-module-2.83

Answered by MohammadHossein Jamshidi on January 30, 2021

One of the most important things to be aware of is installing the correct version of the tools:

Using the current 2.91 Blender version we should use Python 3.7. We can install that using Anaconda3 2020.02 from exe, list of packages.

After that we need to install the blender kernel from here, using the following command in anaconda terminal:

python -m pip install blender_notebook
blender_notebook install --blender-exec="C:Program FilesBlender FoundationBlender 2.91blender.exe"

Now, when we start Jupyter Notebook we can select blender kernel.

First, you need to import the Blender specific library bpy:

# blender related imports
import bpy

After that, we are able to use many examples, already available out there.

I've made an example Jupyter Notebook on this topic, available here

See the discussion and plans on updating blender's python version here.

Answered by minus one on January 30, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP