diff --git a/.github/workflows/cache.yml b/.github/workflows/cache.yml index e617bc8..3cbf454 100644 --- a/.github/workflows/cache.yml +++ b/.github/workflows/cache.yml @@ -23,8 +23,19 @@ jobs: - name: Install JAX, Numpyro shell: bash -l {0} run: | - pip install --upgrade "jax[cuda12-local]" - pip install numpyro + # CUDA 12 stack. .github/runs-on.yml pins ami-09baf66e396fa7cfd, a CUDA 12 + # AMI, so do not move to cu130 / jax[cuda13] without bumping the AMI first. + # torch and pyro-ppl were never installed here even though bayes_nonconj.md + # imports both -- this workflow has never produced a successful build. + pip install torch --index-url https://download.pytorch.org/whl/cu128 + pip install pyro-ppl + pip install "jax[cuda12]==0.7.1" + pip install numpyro + # See the equivalent block in ci.yml for why the conda stack must be held. + python -c "import importlib.metadata as md; d={x.metadata['Name'].lower():x.version for x in md.distributions()}; print('\n'.join(f'{p}=={d[p]}' for p in ('numpy','pandas','scipy') if p in d))" > /tmp/conda-pins.txt + cat /tmp/conda-pins.txt + pip install --only-binary=:all: -c /tmp/conda-pins.txt "arviz<1" "pymc<6" "kaleido<1" "prettytable<3.18" + python -c "import numpy, numba; assert numpy.__version__.startswith('1.'), numpy.__version__" python scripts/test-jax-install.py - name: Check nvidia drivers shell: bash -l {0} @@ -44,4 +55,8 @@ jobs: uses: actions/upload-artifact@v6 with: name: build-cache - path: _build \ No newline at end of file + path: _build + # _config.yml sets execute_notebooks: "cache", so the execution cache + # lives in _build/.jupyter_cache. upload-artifact excludes hidden files + # by default, which would ship a "cache" containing no cache. + include-hidden-files: true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b17ca3f..b709608 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,10 +23,30 @@ jobs: - name: Install JAX, Numpyro shell: bash -l {0} run: | - pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu128 + # CUDA 12 stack. .github/runs-on.yml pins ami-09baf66e396fa7cfd, a CUDA 12 + # AMI, so do not move to cu130 / jax[cuda13] without bumping the AMI first. + pip install torch --index-url https://download.pytorch.org/whl/cu128 pip install pyro-ppl - pip install --upgrade "jax[cuda12-local]" - pip install numpyro + pip install "jax[cuda12]==0.7.1" + pip install numpyro + # arviz and pymc are pre-installed at versions the conda stack can carry, so + # the notebooks' own unpinned `!pip install arviz pymc` cells become no-ops. + # They must not be allowed to move the conda-provided scientific stack: left + # free, xarray drags pandas forward, pandas 3.x requires numpy>=2, and pip + # backtracks through pandas until it reaches an sdist that fails to build + # (the numpy Cython headers need Cython>=3). numpy>=2 would also break numba + # 0.60.0, which caps at numpy<2.1 and is imported by 9 lectures. + # The constraints file is derived from the env rather than hardcoded so that + # bumping anaconda in environment.yml does not silently invalidate it. + # prettytable<3.18 is a real fix, not hygiene: prettytable declares a bare + # "wcwidth" with no floor, so pip accepts conda's wcwidth 0.2.x as satisfying + # it, but 3.18.0 calls wcwidth.width(), which only exists from wcwidth 0.3.0. + # That AttributeError is what broke prob_matrix.md in run 30975106893. + # 3.17.0 still uses wcswidth(), which conda's wcwidth has. + python -c "import importlib.metadata as md; d={x.metadata['Name'].lower():x.version for x in md.distributions()}; print('\n'.join(f'{p}=={d[p]}' for p in ('numpy','pandas','scipy') if p in d))" > /tmp/conda-pins.txt + cat /tmp/conda-pins.txt + pip install --only-binary=:all: -c /tmp/conda-pins.txt "arviz<1" "pymc<6" "kaleido<1" "prettytable<3.18" + python -c "import numpy, numba; assert numpy.__version__.startswith('1.'), numpy.__version__" python scripts/test-jax-install.py # Check nvidia drivers - name: nvidia Drivers @@ -56,7 +76,7 @@ jobs: uses: actions/upload-artifact@v6 if: failure() with: - name: execution-reports + name: execution-reports-notebooks path: _build/jupyter/reports - name: Build PDF from LaTeX shell: bash -l {0} @@ -68,7 +88,7 @@ jobs: uses: actions/upload-artifact@v6 if: failure() with: - name: execution-reports + name: execution-reports-latex path: _build/latex/reports # Final Build of HTML - name: Build HTML @@ -79,7 +99,7 @@ jobs: uses: actions/upload-artifact@v6 if: failure() with: - name: execution-reports + name: execution-reports-html path: _build/html/reports - name: Preview Deploy to Netlify uses: nwtgck/actions-netlify@v3 diff --git a/.github/workflows/collab.yml b/.github/workflows/collab.yml index a3f0fe5..8870252 100644 --- a/.github/workflows/collab.yml +++ b/.github/workflows/collab.yml @@ -37,6 +37,11 @@ jobs: shell: bash -l {0} run: | pip install jupyter-book==1.0.3 quantecon-book-theme==0.8.2 sphinx-tojupyter==0.3.0 sphinxext-rediraffe==0.2.7 sphinxcontrib-youtube==1.3.0 sphinx-togglebutton==0.3.2 arviz sphinx-proof sphinx-exercise sphinx-reredirects + # The Colab image ships plotly 5.24.1 and no kaleido, so back_prop.md's + # `!pip install kaleido` cell pulls kaleido 1.x, which is incompatible. + # Pinning here makes that cell a no-op. Unlike the conda workflows, this + # container is a coherent numpy 2.0.2 stack, so it needs no numpy pin. + pip install "kaleido<1" # Build of HTML (Execution Testing) - name: Build HTML shell: bash -l {0} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index cae7931..0e39387 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -25,8 +25,17 @@ jobs: - name: Install JAX, Numpyro shell: bash -l {0} run: | - pip install --upgrade "jax[cuda12-local]" - pip install numpyro + # CUDA 12 stack. .github/runs-on.yml pins ami-09baf66e396fa7cfd, a CUDA 12 + # AMI, so do not move to cu130 / jax[cuda13] without bumping the AMI first. + pip install torch --index-url https://download.pytorch.org/whl/cu128 + pip install pyro-ppl + pip install "jax[cuda12]==0.7.1" + pip install numpyro + # See the equivalent block in ci.yml for why the conda stack must be held. + python -c "import importlib.metadata as md; d={x.metadata['Name'].lower():x.version for x in md.distributions()}; print('\n'.join(f'{p}=={d[p]}' for p in ('numpy','pandas','scipy') if p in d))" > /tmp/conda-pins.txt + cat /tmp/conda-pins.txt + pip install --only-binary=:all: -c /tmp/conda-pins.txt "arviz<1" "pymc<6" "kaleido<1" "prettytable<3.18" + python -c "import numpy, numba; assert numpy.__version__.startswith('1.'), numpy.__version__" python scripts/test-jax-install.py - name: Check nvidia drivers shell: bash -l {0}