Skip to content

fix: requirements for tutorials 6/7 + revert workshop Colab stopgap #65

Description

@Jammy2211

Overview

HowToFit tutorials 6 and 7 construct af.BlackJAXNUTS (tutorial 6 also af.Nautilus), but neither blackjax nor nautilus-sampler is on the documented local install route: PyAutoFit declares them only in its optional extra and HowToFit/requirements.txt is just autofit + numba. CI runs at PYAUTO_TEST_MODE=2, which bypasses the sampler, so the smoke gate is green while a reader hits ModuleNotFoundError: No module named 'blackjax'.

The Colab leg of this prompt already merged as PyAutoNerves#168 (_SHARED_EXTRAS now carries blackjax>=1.6.2 and nautilus-sampler==1.0.5) and goes live with the next autonerves PyPI release — PyPI is still 2026.9.15.1, which predates it. This task does the remaining local-install leg and, at the human's request now that the 2026-09-15 workshop is over, reverts the Colab stopgap that was merged for it (HowToFit #63/#64, HowToGalaxy #77, HowToLens #85), each of which was labelled "REMOVE once autonerves > 2026.9.15.1".

Merge condition: reverting the stopgap before autonerves > 2026.9.15.1 is on PyPI re-opens the Colab gap on every notebook until that release lands. Merge these PRs only once pip index versions autonerves shows a newer version, or with the human explicitly accepting the interim gap.

Plan

  • Add blackjax and nautilus-sampler to HowToFit/requirements.txt so the local route installs what the tutorials run.
  • Revert the four workshop-stopgap merges with plain git revert -m 1 commits (no history rewrite) in HowToFit, HowToGalaxy and HowToLens.
  • Revert HowToFit fix: point Colab links at main so the #63 dependency stopgap reaches readers #64's README badge repointing too: the release tool only re-pins version-shaped badge tags, so blob/main/ links would never be re-pinned.
  • One PR per repo, all cross-referencing this issue; no smoke run is meaningful for a pure revert to released notebooks plus a requirements line.
  • Out of scope: cutting the autonerves release; a smoke-profile import guard for constructed searches (separate prompt); the /prm close-out of the colab-workshop-dep-stopgap task.
Detailed implementation plan

Work Classification

Workspace

Affected Repositories

  • HowToFit (primary)
  • HowToGalaxy
  • HowToLens

Branch Survey

Repository Current Branch Dirty?
./HowToFit main @ f4bca40 clean
./HowToGalaxy main @ 95eb176 clean
./HowToLens main @ 5c3c727 clean

Worktree guard: HowToFit/HowToGalaxy/HowToLens are claimed by colab-workshop-dep-stopgap (all PRs merged, stale claim) and HowToFit by howtofit-mode (README/AGENTS prompt propagation, 0 own commits). Human-approved parallel-claim override 2026-09-15; file sets disjoint.

Suggested branch: feature/blackjax-reqs-stopgap-revert
Worktree root: ~/Code/PyAutoLabs-wt/blackjax-reqs-stopgap-revert/

Implementation Steps

  1. HowToFit: git revert -m 1 f4bca40 (PR fix: point Colab links at main so the #63 dependency stopgap reaches readers #64: 20 README badges blob/2026.9.15.1/ → blob/main/, stopgap cell in start_here.ipynb), then git revert -m 1 1b85e12 (PR fix: install autofit's lazily-imported deps in the Colab setup cell #63: stopgap cell in 18 notebooks/**/*.ipynb + one README paragraph).
  2. HowToFit: edit requirements.txt to autofit, numba, blackjax, nautilus-sampler (unpinned, matching the file's and its siblings' convention; pinned literals would recreate the drift PyAutoNerves#168 fixed). Separate commit from the reverts.
  3. HowToGalaxy: git revert -m 1 95eb176 (PR #77: stopgap cell in 32 notebooks).
  4. HowToLens: git revert -m 1 5c3c727 (PR #85: stopgap cell in 50 notebooks).
  5. Verify per repo: git diff 2026.9.15.1 HEAD --stat is empty for HowToGalaxy/HowToLens and, for HowToFit, shows only bd08343's docs change plus requirements.txt | 2 +; HowToFit README has 20 blob/2026.9.15.1/ and 1 blob/main/ link (the tagged counts); every touched .ipynb parses as JSON; a scratch venv pip install -r requirements.txt followed by python -c "import blackjax, nautilus" succeeds.
  6. ship_workspace: one PR per repo against main, PR bodies carrying the merge condition above.

Key Files

  • HowToFit/requirements.txt — the local install route the tutorials document.
  • HowToFit/README.md, HowToFit/start_here.ipynb, HowToFit/notebooks/**/*.ipynb — restored to the 2026.9.15.1 content by the reverts.
  • HowToGalaxy/notebooks/**/*.ipynb, HowToLens/notebooks/**/*.ipynb — same.
  • PyAutoHands/autohands/bump_colab_urls.sh:30 — why the blob/main/ badges must not stay.
  • PyAutoNerves/autonerves/setup_colab.py _SHARED_EXTRAS — the already-merged Colab fix (#168).

Original Prompt

Click to expand starting prompt

HowToFit tutorials 6 and 7 die at the NUTS fit — blackjax is on no install route

Type: bug
Target: HowToFit
Repos:

  • HowToFit
  • PyAutoNerves
    Themes:
  • tutorials
  • colab
  • dependencies
    Difficulty: small
    Autonomy: safe
    Priority: high
    Status: formalised
    Consequence: judge
    Review-minutes: 10
    Unattended: ready
    Witness: with only pip install autofit numba (or a Colab setup_colab.setup("howtofit")), python3 scripts/chapter_1_introduction/tutorial_6_gradients.py and tutorial_7_the_details.py both run to completion instead of raising ModuleNotFoundError: No module named 'blackjax'.
    Filed: 2026-09-15

Symptom

Measured 2026-09-15 against HowToFit main @ b174c03 (PR #62), PyAutoFit main,
Python 3.12.3, at real settings (no PYAUTO_TEST_MODE, visualization on):

tutorial_6_gradients.py    FAIL (11.0s)  ModuleNotFoundError: No module named 'blackjax'
tutorial_7_the_details.py  FAIL (67.1s)  ModuleNotFoundError: No module named 'blackjax'

Installing blackjax>=1.6.2 and nautilus-sampler and re-running, nothing
else changed: tutorial 6 rc=0 in 43s, tutorial 7 rc=0 in 73s, both completing
their real BlackJAXNUTS (and, in 6, Nautilus) fits. The missing
dependency is the whole defect.

Why no gate sees it

CI runs PYAUTO_TEST_MODE=2 (config/build/profile_smoke.yaml), which
bypasses the sampler, so af.BlackJAXNUTS is never constructed and blackjax
is never imported. Both tutorials PASS the smoke gate — 18/18 green — while
being unrunnable by a reader. This is the same blind spot config/build/no_run.yaml
already documents for tutorial_5_expectation_propagation ("only passes today
because CI runs at PYAUTO_TEST_MODE=2, which bypasses the sampler").

Why it is missing on every route

  • HowToFit/requirements.txt is autofit + numba.
  • PyAutoFit declares blackjax in the optional extra, not the base
    dependencies (PyAutoFit/pyproject.toml:83, [project.optional-dependencies] optional), so pip install autofit does not bring it. Same for
    nautilus-sampler, which tutorial 6 also runs (:727).
  • Colab: autonerves/setup_colab.py installs _SHARED_EXTRAS with --no-deps
    (:280). _SHARED_EXTRAS (:37-46) lists pyvis, dill, jaxnnls,
    nautilus-sampler, timeout_decorator, anesthetic, emcee, dynesty — and no
    blackjax. Exactly the gap PyAutoNerves #166 closed for emcee and dynesty,
    one package short.

Searches actually run: tutorial 6 — LBFGS, MultiStartAdam, Emcee,
BlackJAXNUTS(:685), Nautilus(:727); tutorial 7 — DynestyStatic x3,
Emcee x2, MultiStartAdam x2, BlackJAXNUTS(:1086).

Tutorial 7's NUTS fit is new tonight: PR #62 moved the Hamiltonian
diagnostics out of tutorial 6 and gave tutorial 7 its own short BlackJAXNUTS
fit, so tutorial 7 is a fresh breakage, tutorial 6 a pre-existing one.

Fix

  1. PyAutoNerves/autonerves/setup_colab.py: add "blackjax>=1.6.2" to
    _SHARED_EXTRAS, tracking PyAutoFit/pyproject.toml's specifier as the
    emcee/dynesty entries already do.
  2. HowToFit/requirements.txt: add blackjax and nautilus-sampler so the
    documented local route installs what the tutorials run.
  3. While there: _SHARED_EXTRAS pins nautilus-sampler==1.0.4 where
    PyAutoFit's optional extra pins ==1.0.5. Reconcile.

A follow-up worth its own prompt: the smoke profile's PYAUTO_TEST_MODE=2
cannot see a missing sampler dependency at all. A cheap guard is an import
check over the af.<Search> classes each script constructs, run at smoke
settings.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions