matplotlib / ipympl

Matplotlib Jupyter Integration
https://matplotlib.org/ipympl/
BSD 3-Clause "New" or "Revised" License
1.59k stars 225 forks source link

Figures are not visible in docs using nbsphinx and ipympl=0.9 #462

Closed nvaytet closed 2 years ago

nvaytet commented 2 years ago

Describe the issue

After updating to version 0.9, plots no longer show up in documentation pages when using nbsphinx.

Here is a dummy project as an example: Files:

conf.py:

html_show_sourcelink = True
project = u'dummy'

extensions = [
    'nbsphinx',
]

source_suffix = '.rst'

master_doc = 'index'

html_theme = 'sphinx_book_theme'

example.ipynb: Screenshot at 2022-04-19 15-32-36

index.rst:

Dummy
=====

.. toctree::
   :maxdepth: 3
   :caption: Example

   example

Then, building the docs with sphinx-build -b html . build and viewing the docs in a browser: Screenshot at 2022-04-19 15-24-54 There are some errors in the Chrome console: Screenshot at 2022-04-19 15-24-47

With version 0.8.8: Screenshot at 2022-04-19 15-29-09 and the console Screenshot at 2022-04-19 15-28-56

I notice in the chrome console that the versions of jupyter-matplotlib are different (0.10.5 and 1.0.0).

Versions

 3.9.5 (default, Jun  4 2021, 12:28:51) 
[GCC 7.5.0]
ipympl version: 0.9.0
Selected Jupyter core packages...
IPython          : 7.29.0
ipykernel        : 6.4.2
ipywidgets       : 7.6.5
jupyter_client   : 7.0.6
jupyter_core     : 4.9.1
jupyter_server   : 1.11.2
jupyterlab       : 3.2.1
nbclient         : 0.5.4
nbconvert        : 6.2.0
nbformat         : 5.1.3
notebook         : 6.4.5
qtconsole        : not installed
traitlets        : 5.1.1
Known nbextensions:
  config dir: /home/nvaytet/software/miniconda3/etc/jupyter/nbconfig
    notebook section
      jupyter-datawidgets/extension  enabled 
      - Validating: OK
      jupyter-matplotlib/extension  enabled 
      - Validating: OK
      jupyter-threejs/extension  enabled 
      - Validating: OK
      jupyter_bokeh/extension  enabled 
      - Validating: OK
      jupyter_dash/main  enabled 
      - Validating: OK
      jupyterlab-plotly/extension  enabled 
      - Validating: OK
      jupyter-js-widgets/extension  enabled 
      - Validating: OK
JupyterLab v3.2.1
/home/nvaytet/software/miniconda3/share/jupyter/labextensions
        jupyter-matplotlib v0.11.0 enabled OK
        jupyter-threejs v2.3.0 enabled OK (python, pythreejs)
        jupyterlab-datawidgets v7.0.0 enabled OK
        jupyterlab-plotly v5.6.0 enabled OK
        @bokeh/jupyter_bokeh v3.0.2 enabled OK (python, jupyter_bokeh)
        @jupyter-widgets/jupyterlab-manager v3.0.1 enabled OK (python, jupyterlab_widgets)

Other labextensions (built into JupyterLab)
   app dir: /home/nvaytet/software/miniconda3/share/jupyter/lab
        jupyterlab-dash v0.4.1 enabled OK

Build recommended, please run `jupyter lab build`:
    jupyterlab-dash needs to be included in build
martinRenou commented 2 years ago

0.9.1 should fix this issue. I will mark the 0.9.0 release as broken on conda-forge.