Skip to main content

Use of Python Packages

Install and uninstall packages.

import subprocess
import sys
subprocess.check_call([sys.executable, "-m", "pip", "install", "polars"])
subprocess.check_call([sys.executable, "-m", "pip", "install", "databpy"])
subprocess.check_call([sys.executable, "-m", "pip", "install", "nodebpy"])
Collecting polars
  Using cached polars-2.1.0-py3-none-any.whl.metadata (11 kB)
Collecting polars-runtime-32==2.1.0 (from polars)
  Using cached polars_runtime_32-2.1.0-cp311-abi3-macosx_11_0_arm64.whl.metadata (1.5 kB)
Using cached polars-2.1.0-py3-none-any.whl (911 kB)
Using cached polars_runtime_32-2.1.0-cp311-abi3-macosx_11_0_arm64.whl (47.6 MB)
Installing collected packages: polars-runtime-32, polars
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2/2 [polars]2m1/2 [polars]
Successfully installed polars-2.1.0 polars-runtime-32-2.1.0
Requirement already satisfied: databpy in ./Applications/Blender.app/Contents/Resources/5.3/python/lib/python3.13/site-packages (0.12.0)
Requirement already satisfied: numpy in ./Applications/Blender.app/Contents/Resources/5.3/python/lib/python3.13/site-packages (from databpy) (2.3.4)
[notice] A new release of pip is available: 26.2.2 -> 26.3
[notice] To update, run: /Applications/Blender.app/Contents/Resources/5.3/python/bin/python3.13 -m pip install --upgrade pip

[notice] A new release of pip is available: 26.2.2 -> 26.3
[notice] To update, run: /Applications/Blender.app/Contents/Resources/5.3/python/bin/python3.13 -m pip install --upgrade pip
Requirement already satisfied: nodebpy in ./Applications/Blender.app/Contents/Resources/5.3/python/lib/python3.13/site-packages (530.0.3)
[notice] A new release of pip is available: 26.2.2 -> 26.3
[notice] To update, run: /Applications/Blender.app/Contents/Resources/5.3/python/bin/python3.13 -m pip install --upgrade pip
0
# non-interactive uninstall  from Blender’s Python
subprocess.check_call([sys.executable, "-m", "pip", "uninstall", "-y", "polars"])
Found existing installation: polars 2.1.0
Uninstalling polars-2.1.0:
  Successfully uninstalled polars-2.1.0
0
#On MacOS, if uv is installed via homebrew:
command = [
    "UV_PYTHON=python3.11",
    "/opt/homebrew/bin/uv", "pip", "install",
    "--prefix", "/Applications/Blender.app/Contents/Resources/4.3/python/",
    "matplotlib"
]
subprocess.run(" ".join(command), shell=True)
Using CPython 3.11.10
Resolved 11 packages in 393ms
Downloading pillow (4.6MiB)
Downloading numpy (5.2MiB)
Downloading matplotlib (8.9MiB)
Downloading fonttools (3.0MiB)
 Downloaded fonttools
 Downloaded pillow
 Downloaded numpy
 Downloaded matplotlib
Prepared 6 packages in 1.36s
Installed 11 packages in 47ms
 + contourpy==1.3.3
 + cycler==0.12.1
 + fonttools==4.68.0
 + kiwisolver==1.5.1
 + matplotlib==3.11.2
 + numpy==2.4.6
 + packaging==26.3
 + pillow==13.0.0
 + pyparsing==3.3.3
 + python-dateutil==4.0.0
 + tzdata==2026.6
CompletedProcess(args='UV_PYTHON=python3.11 /opt/homebrew/bin/uv pip install --prefix /Applications/Blender.app/Contents/Resources/4.3/python/ matplotlib', returncode=0)
# version check
import importlib.metadata

print("Databpy version:", importlib.metadata.version("databpy"))
Databpy version: 0.12.0
# version check
print("Nodbpy version:", importlib.metadata.version("nodebpy"))
Nodbpy version: 530.0.1