Skip to content

fix: install emcee and dynesty in the Colab bootstrap - #164

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/howtofit-tutorials-1-3
Sep 14, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/howtofit-tutorials-1-3

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Refs PyAutoLabs/HowToFit#57.

The failure

A reader working through HowToFit tutorial 3 on Colab hit:

ModuleNotFoundError: No module named 'emcee'
  .../autofit/non_linear/search/mcmc/emcee/search.py:135 in _fit

Cause

_colab_setup installs the project stack with --no-deps, on the premise that Colab already ships the scientific stack. That premise holds for numpy, scipy and matplotlib. It does not hold for emcee>=3.1.6 and dynesty==2.1.5, which are declared dependencies of autofit (PyAutoFit/pyproject.toml) and are not installed by Colab — and neither was named in _SHARED_EXTRAS, so neither ever landed.

Every Colab notebook that runs af.Emcee therefore dies at the fit, and would die again at af.DynestyStatic. That is all six Colab-enabled projects (autofit, autogalaxy, autolens, howtofit, howtogalaxy, howtolens), since autofit is in every stack.

Change

Adds emcee>=3.1.6 and dynesty==2.1.5 to _SHARED_EXTRAS, matching the specifiers autofit declares, plus a comment recording why a --no-deps install has to name its siblings' real dependencies.

Testing

pytest test_autonerves — 183 passed. test_setup_colab.py alone: 20 passed. (It asserts packages[0] == "autonerves", which the append preserves.)

Note

This reaches users on the next autonerves release, not on merge — the Colab cell installs autonerves from PyPI.

black --check reports one pre-existing reformat in _clone_workspace, untouched by this change and not gated by CI; left alone rather than mixed into this diff.

🤖 Generated with Claude Code

https://claude.ai/code/session_0132v5TNVbbvBBESAefHwnwG

The Colab setup installs the PyAuto stack with `--no-deps`, on the premise
that Colab already ships the scientific stack. `emcee` and `dynesty` are
real `autofit` dependencies (PyAutoFit/pyproject.toml) that Colab does not
ship and `_SHARED_EXTRAS` did not name, so they never landed: every Colab
notebook that runs `af.Emcee` or `af.DynestyStatic` died with
`ModuleNotFoundError` at the fit. Reported against HowToFit tutorial 3.

Both are now named in `_SHARED_EXTRAS` with the specifiers autofit declares,
and a comment records why a `--no-deps` install has to list them.

Refs PyAutoLabs/HowToFit#57

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0132v5TNVbbvBBESAefHwnwG
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