lectures/networks.md imports quantecon but never installs it. Its pip cell at line 19 installs only quantecon-book-networks==1.6 and pandas-datareader, while line 56 does import quantecon as qe.
It works today because three earlier lectures in the TOC install quantecon into the same runner environment, and pip installs persist across notebooks within a build:
| TOC position |
Lecture |
pip cell |
| 35 |
markov_chains_I |
!pip install quantecon |
| 36 |
markov_chains_II |
!pip install quantecon |
| 40 |
eigen_II |
!pip install quantecon |
| 43 |
networks |
!pip install quantecon-book-networks==1.6 pandas-datareader |
So networks.md has an implicit dependency on lecture execution order, and a full cold build satisfies it by accident.
When it stops working
The moment networks.md executes without those earlier lectures also executing. That is not hypothetical — it is the normal case whenever the build cache is warm and only this lecture changed. jupyter-cache re-executes the notebooks whose content changed and reuses the rest, so a one-line edit to networks.md runs it in an environment where none of the earlier pip cells have fired.
Observed in the Chinese edition (lecture-intro.zh-cn#276): an unrelated edit to a code cell in networks.md produced
ModuleNotFoundError: No module named 'quantecon'
at line 5 of the imports cell, with every other lecture served from cache. The lecture had been building green for months.
Suggested fix
Add quantecon to this lecture's own pip cell, so it is self-sufficient:
!pip install quantecon quantecon-book-networks==1.6 pandas-datareader
That matches the convention already used elsewhere in this repo — packages outside the anaconda distribution are installed at the start of the lecture that needs them — and removes the ordering dependency entirely.
Worth a wider check: any lecture that imports a non-anaconda package it does not itself install has the same latent fault, and it will stay invisible until that lecture is edited in isolation.
Found while reviewing figure-font handling across the translation editions; the Chinese edition carries the identical gap because it is a faithful translation of this file.
lectures/networks.mdimportsquanteconbut never installs it. Its pip cell at line 19 installs onlyquantecon-book-networks==1.6andpandas-datareader, while line 56 doesimport quantecon as qe.It works today because three earlier lectures in the TOC install
quanteconinto the same runner environment, and pip installs persist across notebooks within a build:markov_chains_I!pip install quanteconmarkov_chains_II!pip install quanteconeigen_II!pip install quanteconnetworks!pip install quantecon-book-networks==1.6 pandas-datareaderSo
networks.mdhas an implicit dependency on lecture execution order, and a full cold build satisfies it by accident.When it stops working
The moment
networks.mdexecutes without those earlier lectures also executing. That is not hypothetical — it is the normal case whenever the build cache is warm and only this lecture changed.jupyter-cachere-executes the notebooks whose content changed and reuses the rest, so a one-line edit tonetworks.mdruns it in an environment where none of the earlier pip cells have fired.Observed in the Chinese edition (lecture-intro.zh-cn#276): an unrelated edit to a code cell in
networks.mdproducedat line 5 of the imports cell, with every other lecture served from cache. The lecture had been building green for months.
Suggested fix
Add
quanteconto this lecture's own pip cell, so it is self-sufficient:That matches the convention already used elsewhere in this repo — packages outside the anaconda distribution are installed at the start of the lecture that needs them — and removes the ordering dependency entirely.
Worth a wider check: any lecture that imports a non-anaconda package it does not itself install has the same latent fault, and it will stay invisible until that lecture is edited in isolation.
Found while reviewing figure-font handling across the translation editions; the Chinese edition carries the identical gap because it is a faithful translation of this file.