Registry / ai-ml / drjit
library1.3.1pypypi✓ verified 85d ago

Dr.Jit is a just-in-time compiler for numerical computation in differentiable rendering, supporting CUDA, LLVM, and scalar backends. It provides automatic differentiation, vectorized operations, and dynamic control flow. Version 1.3.1 is current; releases are active every few months. Requires Python >=3.8.

pip install drjit
INSTALL
IMPORT
SIG · DRJIT
D
drjit
ai-mlpythonv1.3.1
Install
2.0s avg
Import
Disk
32MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
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
musl
py 3.103.95 runs
build_error
glibc
py 3.103.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)
Debug
Known issues
breakingv1.0.0 introduced a new nanobind-based API, breaking backward compatibility with v0.x. The 'drjit.dynamic' module is removed; use top-level functions like dr.if_stmt, dr.while_loop, dr.cond.
fix
Update imports: replace 'from drjit.dynamic import if_stmt' with 'from drjit import if_stmt'.
affects: >=1.0.0
deprecateddr.JitFlag.VCallRecord is deprecated; its use is discouraged and may be removed in future versions.
fix
Set dr.set_flag(dr.JitFlag.VCallRecord, False) to avoid warnings, or omit if not needed.
affects: >=1.2.0
gotchaMixing backends (e.g., CUDA arrays with LLVM operations) causes runtime errors. Dr.Jit arrays are backend-specific and non-interoperable.
fix
Always use types from a single backend: e.g., drjit.cuda.Float3 or drjit.llvm.Float3, not both.
affects: all
deprecateddrjit.plot function has been removed in v1.0.0. Use matplotlib or other plotting libraries for visualization.
fix
Export array to numpy with dr.numpy() and plot with matplotlib.
affects: >=1.0.0
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).
fix
Use '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.
fix
Ensure 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.
fix
Use 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)
Agent activity
11 hits · last 30 days
node
10
OpenAI (training)
1
Resources
drjit — pip install drjit · libregistry