Skip to content

fix: pin jax/jaxlib/flax lower bounds to avoid linear_util ImportError#39

Closed
ayaangazali wants to merge 1 commit into
cactus-compute:mainfrom
ayaangazali:fix/24-jax-flax-version-floors
Closed

fix: pin jax/jaxlib/flax lower bounds to avoid linear_util ImportError#39
ayaangazali wants to merge 1 commit into
cactus-compute:mainfrom
ayaangazali:fix/24-jax-flax-version-floors

Conversation

@ayaangazali

Copy link
Copy Markdown

What

Fixes the ImportError: cannot import name 'linear_util' reported in #24.

Why

pyproject.toml and requirements.txt pin jax, jaxlib and flax with no lower bounds:

jax
jaxlib
flax

so a resolver can land on an old Flax (<0.8) that does from jax import linear_util while pulling a modern JAX. jax.linear_util was removed in JAX 0.4.24, so that combination raises ImportError: cannot import name 'linear_util' at import time — exactly what the reporter hit.

Fix

Add lower bounds so a compatible set is always selected (in both files):

jax>=0.4.30
jaxlib>=0.4.30
flax>=0.8.0

Flax >= 0.8 no longer imports the removed symbol; JAX >= 0.4.30 is a safe, widely-available floor.

Testing

Fresh venv, pip install -e ., then python -c "import needle":

  • resolves jax 0.10.2 / jaxlib 0.10.2 / flax 0.12.7 (all satisfy the floors)
  • import needle and from needle.model.architecture import SimpleAttentionNetwork succeed

Note: PR #29 proposes removing requirements.txt; if it merges first, the pyproject.toml floors still fully cover this fix.

Closes #24

pyproject.toml and requirements.txt pinned jax, jaxlib and flax with no
lower bounds, so the resolver could select an old Flax (<0.8) that does
'from jax import linear_util' against a modern JAX. jax.linear_util was
removed in JAX 0.4.24, producing 'ImportError: cannot import name
linear_util' at import time.

Add floors (jax>=0.4.30, jaxlib>=0.4.30, flax>=0.8.0) so a compatible
set is always resolved.

Closes cactus-compute#24

Signed-off-by: ayaangazali <ayaan.gazly@gmail.com>
Copilot AI review requested due to automatic review settings July 16, 2026 05:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@ayaangazali

Copy link
Copy Markdown
Author

Closing this — we've decided not to pursue contributions to this repo for now. No action needed on your side; feel free to cherry-pick the one-line change if it's useful. Thanks!

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.

from jax import linear_util as lu ImportError: cannot import name 'linear_util'

3 participants