ipython-contrib / jupyter_contrib_nbextensions

A collection of various notebook extensions for Jupyter
http://jupyter-contrib-nbextensions.readthedocs.io/en/latest
Other
5.2k stars 805 forks source link

TOC not displaying at all in Jupyter Notebook #1568

Open aglinn opened 3 years ago

aglinn commented 3 years ago

Do nbextentions not work with Jupyter notebook version 6.x? If so, any tips on how to install an older version of Jupyter? Does not appear to be as simple as installing an older version of python.

Anyway, my problem is that the TOC is not generated at all, even in a brand new notebook with just a couple of markdown cells, using the standard headers, e.g. # Heading1 or ## Heading 2.

I recently had to completely uninstall and rebuild my anaconda; so this part should be quite fresh and free of errors. I created a new environment just to test TOC, installing only PIP, and then running (inside the new environment):

1) pip install https://github.com/ipython-contrib/jupyter_contrib_nbextensions/tarball/master 2) jupyter contrib nbextension install --user

Then, I launched Jupyter Notebook from the correct environment and navigated to the nbextentions tab of my Jupyter landing page in safari. It is interesting that the nbextentions correctly appears, indicating perhaps that my installation is correct. Anyway, at this point I unchecked the "disable configuration for nbextensions without explicit compatibility (they may break your notebook environment, but can be useful to show for nbextension development)" (since nothing appears to work unless I uncheck this). Then, I made sure to check "Table of Contents (2)"—default options selected.

Then, I opened a brand new notebook and tried entering a few headers in mark down for several cells, no luck. Also, no luck in old notebooks that did have working TOCs at one point.

Finally, let me say that I am on a MAC; reiterate that I rebuilt Conda days ago—i.e. should have the most up to date Jupyter, Conda, PIP, TOC, and any other sub packages installed in the process of installing these; and report my output from Jupyter --version: jupyter core : 4.7.1 jupyter-notebook : 6.3.0 qtconsole : not installed ipython : 7.22.0 ipykernel : 5.5.3 jupyter client : 6.1.12 jupyter lab : not installed nbconvert : 6.0.7 ipywidgets : not installed nbformat : 5.1.3 traitlets : 5.0.5

Thank you for the help! Loved TOC and hope to get it to work again!

UPDATE: I gave up on trying to fix this... Then it starting working all of a sudden. No changes to packages etc. Not sure what that is about, but it still does not work on one of my notebooks. That said, it works on some of my old notebooks and also on newly created notebooks. Weird.

goodbyeearth commented 2 years ago

I had the same problem as you and now i fixed.

Change your jupyter_contrib_nbextensions version from the newest to the old one, eg: pip install jupyter_contrib_nbextensions==0.5.1

leodrivera commented 2 years ago

The problem still exists. In the last available version of nbextensions, when exporting with html_toc (jupyter nbconvert Test_toc.ipynb --to html_toc ), I got a almost blank .html file with only 'None' written into the body.

I also tried exporting with only the html tag (jupyter nbconvert Test_toc.ipynb --to html), as implemented by this workaround, however I only got the ordinary html file, without the toc sidebar.

As an effectually workaround, I've installed the nbextensions version 0.5.1 (which can be installed directly by pip install jupyter_contrib_nbextensions, as it was the last version published) and downgraded nbconvert to a version under 6 (pip install "nbconvert<6"), as informed on this topic.

Installed versions:

jupyter contrib nbextensions --version
0.5.3
jupyter --version
Selected Jupyter core packages...
IPython          : 7.30.1
ipykernel        : 6.6.0
ipywidgets       : 7.6.5
jupyter_client   : 7.1.0
jupyter_core     : 4.9.1
jupyter_server   : 1.13.1
jupyterlab       : 3.2.5
nbclient         : 0.5.9
nbconvert        : 6.3.0
nbformat         : 5.1.3
notebook         : 6.4.6
qtconsole        : not installed
traitlets        : 5.a1.1
leodrivera commented 2 years ago

It seems it is related with the problem with the gitcdn, as I described here: https://github.com/ipython-contrib/jupyter_contrib_nbextensions/issues/1533#issuecomment-1016516693

SehyunPark commented 1 year ago

I had the same problem and pip install jupyter_contrib_nbextensions==0.5.1 worked.