Skip to content

[fork CI check] Let the PyMC backend import without jax - #2

Closed
jdeast wants to merge 1 commit into
mainfrom
pymc-backend-without-jax
Closed

[fork CI check] Let the PyMC backend import without jax#2
jdeast wants to merge 1 commit into
mainfrom
pymc-backend-without-jax

Conversation

@jdeast

@jdeast jdeast commented Aug 14, 2026

Copy link
Copy Markdown
Owner

Fork-internal PR to exercise CI before opening upstream. Do not merge.

celerite2/pymc/ops.py imports pytensor.link.jax.dispatch at module scope,
which imports jax. That makes jax a hard requirement of the PyMC backend at
import time:

    >>> from celerite2.pymc import terms
    File "celerite2/pymc/ops.py", line 22, in <module>
        from pytensor.link.jax.dispatch import jax_funcify
    ModuleNotFoundError: No module named 'jax'

The only thing needed from that module is jax_funcify, and it is used
solely to register the JAX conversion -- which is useful exactly when jax
is installed. The conversion body already imports celerite2.jax.ops lazily
inside the function, so this is the last eager jax reference on the PyMC
path.

Guarding the import and registering conditionally leaves the JAX behaviour
identical where jax is present, and lets the PyMC and numpy backends work
where it is not. That matters on platforms jaxlib does not ship wheels for
-- macOS x86_64 stops at jaxlib 0.4.38, and jaxlib has no sdist -- where
installing jax at all is not an option.

Verified both ways against an installed celerite2 with this file patched
in: with jax importable, _CeleriteOp is still in jax_funcify.registry; with
sys.modules['jax'] poisoned to simulate its absence, 'from celerite2.pymc
import terms' succeeds.
@jdeast jdeast closed this Aug 14, 2026
@jdeast jdeast reopened this Aug 14, 2026
@jdeast

jdeast commented Aug 14, 2026

Copy link
Copy Markdown
Owner Author

Superseded by exoplanet-dev#194 (this branch, opened upstream). Fork CI history retained here.

@jdeast jdeast closed this Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant