book-networks-public icon indicating copy to clipboard operation
book-networks-public copied to clipboard

[ch_intro] Not compatible with Google Colab

Open mmcky opened this issue 1 year ago • 1 comments

The Chapter 1 code is not compatible with Google Colab as it request access to latex to render some of the network plots.

PastedGraphic-4

Thanks to a reader for reporting this issue.

mmcky avatar Mar 20 '24 06:03 mmcky

This fixes to this include installing the latex subsystem

!sudo apt-get install texlive-latex-recommended 
!sudo apt-get install dvipng texlive-latex-extra texlive-fonts-recommended
!sudo apt-get install cm-super

ensuring cm-super is installed as the font used by matplotlib

another option is to switch of tex from matplotlib rendering

from matplotlib import rc
rc('text', usetex=False) 

Idea: We may want to add the ability to specify a colab builder as an output in sphinx-tojupyter such as

````{colab}
```{code-cell}
from matplotlib import rc
rc('text', usetex=False) 
```
````

that would include

mmcky avatar Mar 21 '24 00:03 mmcky