Hello,
I have some basic usage questions about JupyterLite.
I’ve followed the nice Deploy your first JupyterLite website on GitHub Pages doc which proposes to use the jupyterlite/demo repo. This was indeed easy enough and brought me back in July:
One thing I really appreciated about this approach (i.e. template repository) is that I was able to get JupyterLite deployed on my GitHub Pages without any previous knowledge of GitHub Pages nor GitHub Actions. So thanks a lot for creating this template repo.
The only logical downside of not learning those technologies is that it’s a bit harder to follow-up on more complicated things (like following the Configure a JupyterLite site section)…
Updating JupyterLite
My copy of the jupyterlite/demo template got me version JupyterLite version 0.1.0-beta.10 while a beta 12 has been released since. Looking at the commits on jupyterlite/demo, is it true that I only need to update my requirements.txt file? Should I do it manully or using some tool to check the consistency?
Also, should I check and update the configuration of Github Actions?
EDIT: I juste read more carefully Deploy your first JupyterLite website on GitHub Pages, and it clearly mentions that updating JupyterLite should be done by changing requirements.txt
. However the question of the consistency of manual edits still holds.
Using Micropip inside a script
Since there is no way to pre-run Python code (from what I got from open issues #461 and #508), I’ve gathered the setup code of my demo inside a script (microgrid_showcase_setup.py) which gets run inside the notebook using the %run -i
magic (with -i
to be able to change some global parameters later on).
It contains these package installation and import section:
try: # Install microgrids & ipywidgets packages in JupyterLite (if run in JupyterLite)
import piplite
async def install_packages():
await piplite.install(['microgrids', 'ipywidgets'])
print('Microgrids & ipywidgets packages installed with piplite.')
# Get away with the fact that `await` is not allowed in a script:
import asyncio
loop = asyncio.get_event_loop()
loop.run_until_complete(install_packages())
except ImportError:
pass
from ipywidgets import interactive, fixed
However, when I run it for the first time, I get the ModuleNotFoundError: No module named 'ipywidgets'
error. I only works if I re-run the cell (with %run -i my_setup.py
) a second time (actually, this was the behavior in late July, but today it never works!).
Did I got someting wrong about using Micropip?
Installing ipywidgets fails (but it worked in late July!)
In a longer demo (https://microgrids-x.github.io/Microgrids.web/lab?path=Microgrid_py_PV_BT_DG.ipynb), I’m not using a setup script but rather running the package installation in a cell:
try:
import piplite
await piplite.install(['ipywidgets'])
except ImportError:
pass
This was working in late July, but know I get ValueError: Couldn’t find a pure Python 3 wheel for ‘widgetsnbextension~=4.0’. You can use micropip.install(..., keep_going=True)
to get a list of all packages with missing wheels.
Did I miss something? Is there an interference between a recent release of Jupyter widgets and my requirements.txt which contains ipywidgets>=7.7,<8
?