Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Struggling to update offline setup from 0.1.0 to 0.2.3 #1311

Open
epugh opened this issue Feb 9, 2024 · 6 comments
Open

Struggling to update offline setup from 0.1.0 to 0.2.3 #1311

epugh opened this issue Feb 9, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@epugh
Copy link

epugh commented Feb 9, 2024

Description

I have a public opensource project for Quepid that wraps up our Jupterlite setup. I am attempting to upgrade from 0.1.0 to 0.2.3 and the upgrade path hasn't been as clear as I was hoping.

Here is the PR with my progress so far... o19s/quepid-jupyterlite#3

One wrinkle is that we require the offline mode. If I do an online mode, it works, but offline it doesn't, and I suspect it's cause I'm not using the right pyodide?

Reproduce

Here is what I do:

[email protected]:o19s/quepid-jupyterlite.git
git checkout bump_jupyterlite_0_2x
docker run -it --rm -e TARGET_DIR=/dist -v "$(pwd)":/dist $(docker build -q .)
untar -xvf jupyter-lite-build.tgz
python3 -m http.server 8000 --directory ./notebooks

Open it up on http://localhost:8000 and I have kernals, but when I go to load them I get an error about missing files and wasm not instantiated.

Expected behavior

It runs offline!

Context

  • JupyterLite version: 0.2.3
  • Operating System and version: OSX
  • Browser and version: Chrome
Browser Output image
@epugh epugh added the bug Something isn't working label Feb 9, 2024
@jtpio
Copy link
Member

jtpio commented Feb 9, 2024

Thanks @epugh for the report.

The downloading of a specific Pyodide version that can be used offline is now handled in the jupyterlite-pyodide-kernel addon: https://github.com/jupyterlite/pyodide-kernel

Normally the --pyodide CLI option should indeed still be supported: https://jupyterlite-pyodide-kernel.readthedocs.io/en/latest/?badge=latest#usage

@jtpio
Copy link
Member

jtpio commented Feb 9, 2024

Ah according to the screenshot in o19s/quepid-jupyterlite#3, it looks like this might be related to the mimetype of the wasm file.

Maybe you could try starting the server with jupyter lite serve to see if that may help? (this command should be able to server .wasm files with the proper mime type)

@epugh
Copy link
Author

epugh commented Feb 9, 2024

I made some progress... I did not have luck with using jupyter lite serve, I think maybe not quite getting the build process to work... However, I did create a server.py (and checked in on the PR) that includes the wasm mimetype, which gets me further.

Running python server in the root and opening http://localhost:8080/notebooks/lab/index.html loads up the homepage with kernals listed!

Creating a python notebook does run into:

image

Do I need to add more modules to my piplite listing?

@jtpio
Copy link
Member

jtpio commented Feb 9, 2024

Not sure if it may be an issue with the offline Pyodide feature, or related to the recent update to Pyodide 0.25.0 released in jupyterlite-pyodide-kernel==0.2.2.

Would you be able to to try with jupyterlite-pyodide-kernel==0.2.1, which uses a previous version of Pyodide?

@epugh
Copy link
Author

epugh commented Feb 9, 2024

okay, by going with jupyterlite-pyodide-kernel==0.2.1 I now load some modules, and then it errors on out BaseComm?

image

I did notice that by removing in my docker command the --pyodide command that my tgz file is much smaller, I suspect because I am not packaging it for offline mode?

@jtpio
Copy link
Member

jtpio commented Feb 9, 2024

I did notice that by removing in my docker command the --pyodide command that my tgz file is much smaller, I suspect because I am not packaging it for offline mode?

Yes, the full pyodide distribution can be quite large when downloaded locally.

okay, by going with jupyterlite-pyodide-kernel==0.2.1 I now load some modules, and then it errors on out BaseComm?

Ah, this may be an issue with a recent ipywidgets release.

As an alternative you may want to consider using the xeus-python kernel as an alternative to Pyodide: https://jupyterlite.readthedocs.io/en/latest/howto/xeus-python/preinstalled_packages.html. It makes pre-installing packages a bit easier and removes the need for using piplite. You may have to convert the list of packages from your jupyter_lite_config.json to an environment.yml. But the packages would be available in the built site and available for offline by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants