Skip to content

Using svg in matplotlib causes voila rendering to hang #1522

@Aleksei-Poliakov

Description

@Aleksei-Poliakov

Description

If svg is used with matplotlib - notebook trying to display a plot using voila causes the rendering to hang. E.g. it says "rendering 1/2 cells" and never finishes.

Reproduce

Given a notebook like this one:

import matplotlib_inline.backend_inline as pltbi
pltbi.set_matplotlib_formats('svg')
import pandas as pd
import numpy as np
import ipywidgets as widgets
from IPython.display import display
import matplotlib.pyplot as plt

periods = pd.period_range('1928-01-01', periods=25359, freq='D')
data = np.random.randint(-5, 6, len(periods))

output_area = widgets.Output()

with output_area:
    fig, ax = plt.subplots()
    pd.Series(data, index=periods).cumsum().plot(ax=ax)
    plt.show()

display(output_area)

Trying to render it with voila (latest version 0.5.8), e.g. https://hub.2i2c.mybinder.org/user/binder-examples-voila-3cs2p9j3/voila/render/index.ipynb (I used the first requirements.txt from the examples page, e.g. https://github.com/binder-examples/voila/blob/main/environment.yml)

  1. Go to https://mybinder.org/
  2. Type https://github.com/binder-examples/voila/tree/main into the github repo input
  3. Click launch button
  4. Copy-paste the notebook above into the index.ipynb
  5. Go to the url like https://hub.2i2c.mybinder.org/user/binder-examples-voila-3cs2p9j3/voila/render/index.ipynb (replace the guid with yours)

Expected behavior

The notebook renders just fine - same way it's rendered if you just run the cells in jupytelab UI.

Context

  • voila version 0.5.8
  • Operating System and version: host - Window 11; server - Ubuntu
  • Browser and version: Chrome 135.0.7049.96

If using JupyterLab

  • JupyterLab version: 4.3.5
Installed Labextensions
Paste the output from your command line running `jupyter labextension list`.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions