Install & Compatibility
Where this runs
tested against v0.8.2 · 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
installs and imports cleanly · install 0.0s · import 0.000s · 56.7MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 13.6s · import 3.458s · 638MB
337MB installed
● package 337MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
blackjax
✓ import blackjax
✗ from blackjax import ... (not for top-level)
Top-level package; submodules like blackjax.mcmc are accessed via dot notation.
Minimal HMC sampling with Blackjax.
import jax
import jax.numpy as jnp
import blackjax
# Define a simple target distribution (2D Gaussian)
def logdensity_fn(x):
return -0.5 * jnp.sum(x**2)
# Build the HMC kernel
kernel = blackjax.hmc(logdensity_fn, step_size=0.1, inverse_mass_matrix=jnp.eye(2), num_integration_steps=10)
# Initialize state
key = jax.random.PRNGKey(0)
initial_position = jnp.array([1.0, 1.0])
initial_state = kernel.init(initial_position)
# Sample
key, subkey = jax.random.split(key)
state, info = kernel.step(subkey, initial_state)
print(state.position)
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'blackjax'
Blackjax not installed or installed in an isolated environment.
fixRun `pip install blackjax` in the correct environment.
AttributeError: module 'blackjax' has no attribute 'mcmc'
Using old import path for samplers.
fixDirectly call `blackjax.hmc(...)` or `blackjax.nuts(...)` instead of `blackjax.mcmc.hmc(...)`.
Upgrade
Version history
1.5latest on PyPI · released Apr 3, 2026
Audit
Dependencies
jaxrequiredCore dependency for computation and autograd
jaxlibrequiredJAX library for CPU/GPU/TPU backends
jaxtypingoptionalType annotations for JAX arrays