matplotlib / matplotlib/ipympl

ipympl does not work in JupyterLite

Open
#334 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
1.7k
Forks
234
PR merge metrics
No merged PRs in 30d

Description

## Describe the issue

Due to a dependency on `tornado` https://github.com/matplotlib/matplotlib/blob/c06e8709dde6504d396349c0c80ef019c88c3927/lib/matplotlib/backends/backend_webagg_core.py#L22, ipympl does not work in [JupyterLite](https://github.com/jtpio/jupyterlite)

We might be able to implement a custom Timer https://github.com/matplotlib/matplotlib/blob/c06e8709dde6504d396349c0c80ef019c88c3927/lib/matplotlib/backends/backend_webagg_core.py#L118 based entirely on `asyncio` (which works on JupyterLite).

## Workaround

As a workaround, one could do
```python
import sys
import types

sys.modules['tornado'] = types.ModuleType('tornadofake')
```

Disclaimer, I would not be held responsible for anything that would go wrong if you copy this code!

Contributor guide

Open the contributing guide

Research direction

Start with matplotlib's lib/matplotlib/backends/backend_webagg_core.py, especially the tornado dependency near line 22 and the Timer around line 118. Check how ipympl reaches this backend in JupyterLite, then verify that the integration works there without tornado and that interactive timers still function using the available asyncio support.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook, python
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.