jupyterlite / demo

JupyterLite demo deployed to GitHub Pages 🚀
https://jupyterlite.github.io/demo
356 stars 192 forks source link

ipywidgets fails to install in jupyterlite/demo deployment with Pyodide kernel (3rd time) #138

Closed pierre-haessig closed 6 months ago

pierre-haessig commented 6 months ago

Hello,

This is, as far as I understand, the return of issues #97 and #127 about ipywidgets failing to install in the Jupyterlite demo deployment with Pyodide kernel.

Reproduce

In the Jupyterlite demo, with the Pyodide kernel based notebook, running the cell magic

%pip install ipywidgets

(or its function based equivalent await piplite.install(['ipywidgets'])) yields an error:

ValueError: Can't find a pure Python 3 wheel for 'widgetsnbextension~=4.0.10'.
See: https://pyodide.org/en/stable/usage/faq.html#why-can-t-micropip-find-a-pure-python-wheel-for-a-package
You can use `await micropip.install(..., keep_going=True)` to get a list of all packages with missing wheels.

Context

jupyterlite-core==0.2.3
jupyterlab~=4.0.11

# Python kernel (optional)
jupyterlite-pyodide-kernel==0.2.3

....
# Python: ipywidget library for Jupyter notebooks (optional)
ipywidgets>=8.1.1,<9
jtpio commented 6 months ago

@pierre-haessig normally this should have been fixed by the latest release of jupyterlite-pyodide-kernel and https://github.com/jupyterlite/demo/pull/135.

Just checked from https://jupyterlite.github.io/demo/lab/index.html and it looks good:

image

pierre-haessig commented 6 months ago

Thanks for the fast feedback. Probably an error on my side since now it works also for me.

Normally I always erase the page data/cache before testing, but perhaps it wasn't erased when I made the test this afternoon. Unless something changed in a matter of 5 hours?

jtpio commented 6 months ago

Normally nothing changed since #135.

But this might become an issue again in the future when there is a new release of ipywidgets. Which requires updating the shims in jupyterlite-pyodide-kernel.

For reference you might also want to try the xeus python kernel (which also supports widgets) with https://jupyterlite-xeus.readthedocs.io/en/latest/ and the template: https://github.com/jupyterlite/xeus-python-demo. This kernel should not have that ipywidgets related issue.

pierre-haessig commented 6 months ago

But this might become an issue again in the future when there is a new release of ipywidgets. Which requires updating the shims in jupyterlite-pyodide-kernel.

For reference you might also want to try the xeus python kernel (which also supports widgets) with https://jupyterlite-xeus.readthedocs.io/en/latest/ and the template: https://github.com/jupyterlite/xeus-python-demo. This kernel should not have that ipywidgets related issue.

Thanks a lot for the feedback.

I think xeus-python kernel already surfaced in a previous discussion and at some point it may become the most reliable option. In the mean time updating pyodide is my shortest path to a fix, since xeus-python can only be bundled with conda-forge packages, not just simple PyPI packages like mine.

jtpio commented 6 months ago

since xeus-python can only be bundled with conda-forge packages, not just simple PyPI packages like mine.

jupyterlite-xeus has some basic support for installing packages from PyPI: https://jupyterlite-xeus.readthedocs.io/en/latest/environment.html#pip-packages

Although with some limitations (as described in the docs). But maybe it can still work with your simple package.