A Method to Install Python Packages for Add-ons & Plugins in Blender (Windows, Blender 4.2+)

Blender add-ons that need NumPy, meshio, or requests hit the same wall: Blender ships its own Python, so system pip does nothing useful. I wrote a small installer that targets Blender’s sys.executable, drops wheels under scripts/modules, and runs in a background thread so the UI stays responsive (Blender 4.2+, Windows). Version française.

Blender Scripting workspace — Text Editor and Run Script

The problem in one sentence

You cannot pip install globally and expect import meshio inside Blender — the interpreter path is Blender’s bundled runtime.

Strategy

PieceRole
sys.executableInvoke pip against Blender’s Python
bpy.utils.user_resource("SCRIPTS", path="modules")Writable install dir per user/version
site.addsitedirMake imports resolve next launch
Background thread + bpy.app.timersAvoid freezing the UI; show popups when done

The installer script (core idea)

REQUIRED_PACKAGES = {
    "fileseq": "fileseq==1.15.2",
    "meshio": "meshio==5.3.4",
    "rich": "rich==13.7.0",
    "requests": "requests==2.31.0",
}

def install_package(package, modules_path):
    subprocess.check_call([
        sys.executable, "-m", "pip", "install",
        "--upgrade", "--target", modules_path, package,
    ])

Full script in the Medium article and my repo copies — includes progress bar hooks and __import__ checks to skip already-installed wheels.

How to run it

Option A — Scripting workspace: paste in Text Editor → Run Script → wait for popup.

Option B — Add-on register():

def register():
    modules_path = get_modules_path()
    append_modules_to_sys_path(modules_path)
    background_install_packages(REQUIRED_PACKAGES, modules_path)

Ship dependencies with your add-on so users are not guessing which Python to use.

Troubleshooting

  • Restart Blender after first install.
  • print(sys.path) if imports fail — confirm modules is listed.
  • Version pin wheels — Blender’s Python version is not your system 3.12.

When not to use this pattern

CaseWhy
Add-on targets many Blender versionsPin and test per minor version
Heavy CUDA stacksMay exceed user GPU/driver setup
Corporate locked-down PCspip may be blocked — vendor wheels manually

Takeaway

Automate dependency install inside Blender’s sandbox; users stop emailing “which Python?” — you own the matrix in REQUIRED_PACKAGES.

References


Originally published on Medium.