Install & Compatibility
Where this runs
tested against v1.3.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
build_error
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 2.0s · import 0.000s · 34MB
32MB installed
● package 32MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
drjit
✓ import drjit as dr
✗ from drjit import *
Wildcard imports are discouraged; use the 'dr' alias.
drjit.llvm.Array3f
✓ from drjit.llvm import Array3f as Float3
✗ from drjit.cuda import Array3f as Float3
Mixing backends will cause runtime errors. Use drjit.llvm for CPU, drjit.cuda for GPU.
drjit.scatter_cas
✓ from drjit import scatter_cas
✗ import drjit; drjit.scatter_cas()
Attribute is available at module level; using dr directly is fine, but ensure function name matches.
drjit.if_stmt
✓ from drjit import if_stmt, cond
✗ from drjit.dynamic import if_stmt
In v1.0+, if_stmt and cond are top-level; the dynamic module is deprecated.
Compile a simple loop with Dr.Jit's syntax transform.
import drjit as dr
dr.set_flag(dr.JitFlag.VCallRecord, False) # disable for simple loops
@dr.syntax
def f(x):
y = dr.zeros(dr.int32, 4)
for i in range(4):
y[i] = x[i] + 1
return y
x = dr.arange(dr.int32, 4)
result = f(x)
print(result)
Errors
Common errors & fixes
ImportError: cannot import name 'if_stmt' from 'drjit'
Attempting to import if_stmt from drjit (it is available in drjit but the import path may be incorrect if using old code).
fixUse 'from drjit import if_stmt' (top-level, no submodule).
RuntimeError: Array types from different backends cannot be mixed
Using a CUDA array in an LLVM context, or vice versa.
fixEnsure all arrays in a single operation originate from the same backend (e.g., all drjit.cuda.* or all drjit.llvm.*).
AttributeError: module 'drjit' has no attribute 'plot'
The plot function was removed in v1.0.0.
fixUse matplotlib: import numpy as np; np_arr = dr.numpy(array); plt.plot(np_arr).
Upgrade
Version history
1.3.1latest on PyPI · released Feb 23, 2026
Audit
Dependencies
nanobindrequiredPython bindings for C++ extensions
llvmoptionalLLVM backend (optional, for CPU JIT)
cudaoptionalCUDA toolkit (optional, for GPU backend)