Repository navigation
fix: install autofit's lazily-imported deps in the Colab setup cell - #85
Merged
Merged
Conversation
The Colab bootstrap installs the stack with `--no-deps`, so any dependency Colab does not itself preinstall must be named in autonerves' `_SHARED_EXTRAS` or it never lands. Four autofit dependencies are missing from that list, and all four are imported lazily — inside a function rather than at module scope — so `import autofit` succeeds, the search runs to completion, and the notebook dies partway through: corner - `corner_cornerpy`; kills the post-fit corner plot optax - MultiStartAdam / MultiStartProdigy xxhash - graphical/EP factor hashing blackjax - BlackJAXNUTS Reported against HowToFit chapter 1 tutorial 5, which died on Colab with `ModuleNotFoundError: No module named 'corner'` after a 2000-step emcee search had already finished. This is a stopgap: the real fix is PyAutoNerves#167, which adds all four to `_SHARED_EXTRAS`. Until that is released, the setup cell installs them itself so the notebooks are self-sufficient. `--no-deps` is required — installing blackjax or optax with dependencies would let pip downgrade Colab's GPU-enabled jax. Remove once autonerves > 2026.9.15.1 is released. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2 of 3 tasks
Jammy2211
pushed a commit
that referenced
this pull request
Sep 15, 2026
…revert revert: workshop Colab dependency stopgap (#85)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
HowToFit chapter 1 tutorial 5 died on Colab with
ModuleNotFoundError: No module named 'corner'— after a 2000-step emcee search had already run to completion, in the results update that follows it.The Colab bootstrap (
autonerves/setup_colab.py) installs the stack with--no-deps, so any dependency Colab does not itself preinstall must be named in its hand-maintained_SHARED_EXTRASlist or it never lands. Four autofit dependencies are missing from that list, and all four are imported lazily — inside a function rather than at module scope — soimport autofitsucceeds, the model builds, the search runs, and the notebook dies partway through:cornercorner_cornerpyoptaxMultiStartAdam/MultiStartProdigyxxhashblackjaxBlackJAXNUTSWorkspace smoke runs at
PYAUTO_TEST_MODE=2, which bypasses the sampler entirely, so these imports are never reached and the scripts pass green while being unrunnable by a reader.What this does
Adds a second
pip installto the Colab setup cell, inside theelse:branch so it only ever runs on Colab, never on a local install. Verified structurally: each cell was parsed withastand the install confirmed to sit in theTrynode'sorelsebody — 100/100 across the three repos.--no-depsis required and deliberate: installing blackjax or optax with dependencies would let pip reinstall or downgrade Colab's GPU-enabled jax and break every GPU runtime.Only these four packages are installed. The
anesthetic,nautilus-sampleranddillpins are deliberately left alone — those are separate questions, and changing an already-working package here would be unnecessary risk.This is a stopgap
The real fix is PyAutoLabs/PyAutoNerves#167, which adds all four to
_SHARED_EXTRAS. Because the setup cell runspip install autonerves --no-depsunpinned at run time, that release fixes every published notebook retroactively — including tag-pinned ones — with no notebook change at all.This PR exists because the Colab badge links point at release tags, not
main, so a notebook edit alone cannot reach an attendee clicking a README badge. It is belt-and-braces for a workshop running today, and it is harmless once the release lands: the extra install becomes a no-op ("Requirement already satisfied").Remove once autonerves > 2026.9.15.1 is released.
Verification
notebooks/touched.ast.parseclean on every modified cell; JSON valid and cell counts unchanged in all.ensure_ascii=True, no trailing newline), so there is no formatting churn.🤖 Generated with Claude Code