302
302
</ span >
303
303
</ a >
304
304
305
- </ li >
306
-
307
- < li class ="md-nav__item ">
308
- < a href ="#python-package-manger-uv " class ="md-nav__link ">
309
- < span class ="md-ellipsis ">
310
- Python Package manger UV
311
- </ span >
312
- </ a >
313
-
314
- </ li >
315
-
316
- < li class ="md-nav__item ">
317
- < a href ="#using-headless-mode " class ="md-nav__link ">
318
- < span class ="md-ellipsis ">
319
- Using Headless Mode
320
- </ span >
321
- </ a >
322
-
323
- </ li >
324
-
325
- < li class ="md-nav__item ">
326
- < a href ="#using-gui-mode " class ="md-nav__link ">
327
- < span class ="md-ellipsis ">
328
- Using GUI Mode
329
- </ span >
330
- </ a >
331
-
332
305
</ li >
333
306
334
307
</ ul >
477
450
</ span >
478
451
</ a >
479
452
480
- </ li >
481
-
482
- < li class ="md-nav__item ">
483
- < a href ="#python-package-manger-uv " class ="md-nav__link ">
484
- < span class ="md-ellipsis ">
485
- Python Package manger UV
486
- </ span >
487
- </ a >
488
-
489
- </ li >
490
-
491
- < li class ="md-nav__item ">
492
- < a href ="#using-headless-mode " class ="md-nav__link ">
493
- < span class ="md-ellipsis ">
494
- Using Headless Mode
495
- </ span >
496
- </ a >
497
-
498
- </ li >
499
-
500
- < li class ="md-nav__item ">
501
- < a href ="#using-gui-mode " class ="md-nav__link ">
502
- < span class ="md-ellipsis ">
503
- Using GUI Mode
504
- </ span >
505
- </ a >
506
-
507
453
</ li >
508
454
509
455
</ ul >
@@ -530,44 +476,75 @@ <h2 id="how-can-i-use-blender-with-python">How can I use Blender with Python?</h
530
476
< li > Headless Mode: In this mode, you install the Blender Python module bpy from PyPi. The Blender GUI doesn’t open, so you can run it even without a Blender installation. </ li >
531
477
< li > GUI Mode: This mode uses your installed Blender version, so you can work in the Blender GUI while sending commands from the notebook.</ li >
532
478
</ ol >
533
- < h2 id ="python-package-manger-uv "> Python Package manger UV</ h2 >
534
- < p > For the installation, we use the package manager < a href ="https://docs.astral.sh/uv/getting-started/installation/ "> uv</ a > .</ p >
535
- < p > The advantage of < code > uv</ code > is that it automatically manages and caches your environment. You can run the same command multiple times without needing virtual environments or handling Python installations manually.</ p >
536
- < p > Installation < strong > macOS</ strong > :
537
- < code > curl -LsSf https://astral.sh/uv/install.sh | sh</ code > </ p >
538
- < p > Installation < strong > Windows</ strong > :
539
- < code > powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"</ code > </ p >
540
- < h2 id ="using-headless-mode "> Using Headless Mode</ h2 >
541
- < p > To start the notebook, run:
542
- < code > uvx --python 3.11 --with bpy==4.2.0 jupyter lab</ code > </ p >
543
- < p > < img alt ="alt text " src ="../first_render.png " /> </ p >
544
- < details class ="code ">
545
- < summary > Code</ summary >
546
- < div class ="language-py highlight "> < pre > < span > </ span > < code > < span id ="__span-0-1 "> < a id ="__codelineno-0-1 " name ="__codelineno-0-1 " href ="#__codelineno-0-1 "> </ a > < span class ="kn "> import</ span > < span class ="w "> </ span > < span class ="nn "> bpy</ span >
479
+ < h1 id ="work-in-progress "> WORK IN PROGRESS.</ h1 >
480
+ < p > Probably in March 2025 there will be a new guide on how to use Blender w. Jupyter.
481
+ Till then, here's the repo for further installation instructions: https://github.com/Octoframes/bpy_jupyter</ p >
482
+ <!-- ## Python Package manger UV
483
+
484
+ For the installation, we use the package manager [uv](https://docs.astral.sh/uv/getting-started/installation/).
485
+
486
+ The advantage of `uv` is that it automatically manages and caches your environment. You can run the same command multiple times without needing virtual environments or handling Python installations manually.
487
+
488
+
489
+ Installation **macOS**:
490
+ `curl -LsSf https://astral.sh/uv/install.sh | sh`
491
+
492
+
493
+ Installation **Windows**:
494
+ `powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"`
495
+
496
+
497
+
498
+ ## Using Headless Mode
499
+
500
+
501
+ To start the notebook, run:
502
+ `uvx --python 3.11 --with bpy==4.2.0 jupyter lab`
503
+
504
+ 
505
+
506
+
507
+ ??? Code
508
+
509
+ <div class="language-py highlight"><pre><span></span><code><span id="__span-0-1"><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="kn">import</span><span class="w"> </span><span class="nn">bpy</span>
547
510
</span><span id="__span-0-2"><a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a><span class="kn">from</span><span class="w"> </span><span class="nn">IPython.display</span><span class="w"> </span><span class="kn">import</span> <span class="n">display</span><span class="p">,</span> <span class="n">Image</span>
548
511
</span><span id="__span-0-3"><a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a><span class="n">bpy</span><span class="o">.</span><span class="n">ops</span><span class="o">.</span><span class="n">render</span><span class="o">.</span><span class="n">render</span><span class="p">()</span>
549
512
</span><span id="__span-0-4"><a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a><span class="n">bpy</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">images</span><span class="p">[</span><span class="s2">"Render Result"</span><span class="p">]</span><span class="o">.</span><span class="n">save_render</span><span class="p">(</span><span class="n">filepath</span><span class="o">=</span><span class="s2">"img.png"</span><span class="p">)</span>
550
513
</span><span id="__span-0-5"><a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a><span class="n">display</span><span class="p">(</span><span class="n">Image</span><span class="p">(</span><span class="n">filename</span><span class="o">=</span><span class="s2">"img.png"</span><span class="p">))</span>
551
514
</span></code></pre></div>
552
- </ details >
553
- < p > < strong > Note:</ strong > The headless mode will < em > only</ em > run with Python 3.11 (as of Blender 4.2).</ p >
554
- < h2 id ="using-gui-mode "> Using GUI Mode</ h2 >
555
- < p > To set up Blender in GUI mode, we first register the Blender kernel with your notebook environment.</ p >
556
- < p > On < strong > macOS</ strong > , run:< br />
557
- < code > uvx blender_notebook install --blender-exec="/Applications/Blender.app/Contents/MacOS/Blender"</ code > </ p >
558
- < p > < code > uvx --python 3.11 jupyter lab</ code > </ p >
559
- < p > (under the hood, this is using < a href ="https://github.com/cheng-chi/blender_notebook "> blender_notebook</ a > )</ p >
560
- < p > On < strong > Windows</ strong > , run:< br />
561
- < code > uvx blender_notebook install --blender-exec="C:\Program Files\Blender Foundation\Blender 4.2\blender.exe"</ code > </ p >
562
- < p > < code > uvx --python 3.11 jupyter lab</ code >
563
- (Windows installation is not yet tested)</ p >
564
- < p > Once set up, you can select the Blender kernel in Jupyter Lab.</ p >
565
- < p > Select the Blender kernel in < strong > JupyterLab</ strong > like this:</ p >
515
+
516
+ **Note:** The headless mode will *only* run with Python 3.11 (as of Blender 4.2).
517
+
518
+ ## Using GUI Mode
519
+
520
+ To set up Blender in GUI mode, we first register the Blender kernel with your notebook environment.
521
+
522
+
523
+
524
+ On **macOS**, run:
525
+ `uvx blender_notebook install --blender-exec="/Applications/Blender.app/Contents/MacOS/Blender"`
526
+
527
+ `uvx --python 3.11 jupyter lab`
528
+
529
+ (under the hood, this is using [blender_notebook](https://github.com/cheng-chi/blender_notebook))
530
+
531
+ On **Windows**, run:
532
+ `uvx blender_notebook install --blender-exec="C:\Program Files\Blender Foundation\Blender 4.2\blender.exe"`
533
+
534
+ `uvx --python 3.11 jupyter lab`
535
+ (Windows installation is not yet tested)
536
+
537
+ Once set up, you can select the Blender kernel in Jupyter Lab.
538
+
539
+ Select the Blender kernel in **JupyterLab** like this:
566
540
<video controls src="../jupyterlab_setup.mp4" title="Title"></video>
567
541
568
- < p > < strong > Note</ strong > : GUI mode also works with other notebook environments, such as VS Code notebooks and Satyrn notebooks.</ p >
569
- < p > Select the Blender kernel in < strong > VS Code</ strong > like this:</ p >
570
- < video controls src ="../vscode_setup.mp4 " title ="Title "> </ video >
542
+
543
+ **Note**: GUI mode also works with other notebook environments, such as VS Code notebooks and Satyrn notebooks.
544
+
545
+
546
+ Select the Blender kernel in **VS Code** like this:
547
+ <video controls src="../vscode_setup.mp4" title="Title"></video> -->
571
548
572
549
573
550
0 commit comments