Forums

Adding TTF fonts to use in an IPython/Jupyter notebooks on PythonAnywhere

Someone just asked us over email how he would add a TTF font so that it would be available in a Jupyter Notebook on PythonAnywhere (eg. Humor Sans so that you can do XKCD-style plots). I thought it would be nice to share the instructions here:

  • Create a directory in your home directory called .fonts
  • In an IPython notebook, run the following two commands (you only need to run them once, so you can delete the cells afterwards, but they do need to be run from a notebook rather than in a console):
    !fc-cache -f -v
    !rm ./.cache/matplotlib/fontList.cache