sono
sono

Reputation: 326

Table of Contents disappeared in Jupyter Notebook

Currently, a jupyter notebook does not show the lateral table of contents. All the other notebooks do. In fact, for that notebook under menu->edit the nbextensions config disappeared, so, it looks like that notebook does not load the extension.

My jupyter version is 4.4.0.

How to fix that notebook?

Upvotes: 8

Views: 13470

Answers (7)

MosQuan
MosQuan

Reputation: 140

For me the reason was 22 emojis in the headers, deleting 5 of them was enough for firefox to get toc back with no reloading and kernel operations.

The other reason could be "include cell output in headings" property set to True (it's the default after the update). You can edit it in the

> Settings
> Table of contents

Untick or paste to "User Preferences"

{"includeOutput": false}

Upvotes: 1

Pierre ALBARÈDE
Pierre ALBARÈDE

Reputation: 463

I have the problem with Jupyter notebook version 6.1.4. After installing nbextensions and enabling extension "Table of Contents (2)" (as "toc" and "toc2" don't work), I cannot obtain the TOC of an a notebook (2.8 MB), while new notebooks have a table of contents.

Reloading, reopening, restarting jupyter does not help, even after a long wait (> 15 min).

I have tried with browsers Mozilla Firefox version 83 and Chromium version 87.

However, a workaround is to create a new notebook (with TOC), then copy all cells from old notebook to new notebook. In order to do this, this might be useful:

Actually I could not copy all cells at once, I had to do three partial copies.

Alas, my method is not only painful but also ineffective in the long term, as the TOC disappeared again.

Restarting the computer worked or did not work.

Opening a small notebook with a table of content and reloading the big notebook worked or did not work.

The problem concerns all Nbextensions, they are just not active for the big notebook. A Javascript console is shown in Google Chrome with Control Shift J.

Error: Load timeout for modules: 
nbextensions/nbextensions_configurator/config_menu/main,nbextensions/init_cell/main,nbextensions/spellchecker/main,nbextensions/toc2/main,nbextensions/jupyter-js-widgets/extension

Upvotes: 0

Thomas
Thomas

Reputation: 473

In my case, disabling my ad-blocker brought the table of contents back.

Upvotes: 1

Ihor B.
Ihor B.

Reputation: 1363

I found the solution to this problem. All those advises like "close and then re-open", "clean output of the notebook" or "re-install extensions" won't work. The problem is in the javascript load timeouts.

In firefox press F12 and press on the red icon in the top right corner - you will see that you have an error

Load timeout for modules: 
custom/custom,nbextensions/nbextensions_configurator/config_menu/main,

bla-bla-bla...

How to solve:

  1. close the notebook in jupyter, open your ipynb file in any text editor, go to the end of it - you will find "metadata" section. Add the line

    "setTimeout": 120

  2. create a file ~/.jupyter/custom/custom.js if you don't have it (I have Linux, where it is in Windows - I have no idea, google for it) and put this contents into this file:

    window.requirejs.config({ waitseconds: 90, // default is 30s });

This page describes the problem in detail: https://github.com/ipython-contrib/jupyter_contrib_nbextensions/issues/1195

Upvotes: 2

Eugene Puninskiy
Eugene Puninskiy

Reputation: 69

For me it seems that one of the following steps worked:

  • Update all packages and jupyter notebook to the latest version using conda
  • Uninstall then install again the nbextensions configurator
  • Reboot the computer

Upvotes: 1

efueyo
efueyo

Reputation: 187

My solution in these cases is, make a copy (File <Make a Copy), delete the original notebook and rename the copy (File <Rename)

Upvotes: 1

sono
sono

Reputation: 326

Apparently, all it needs is to shutdown the notebook. After restarting it, all works fine. I suppose that problem happens when the notebook has been closed wrongly without the proper "close and halt" procedure.

Upvotes: 1

Related Questions