jupyterlite/demo

Can't specify `--pyodide` as a url

CNSeniorious000 opened this issue · 2 comments

Description

I want to use another pyodide baseurl instead of the default pyodide url.

Reproduce

jupyter lite build --pyodide https://cdn.promplate.dev/pyodide/v0.26.1/pyodide.js

It seems I can only provide that as a local file?

Expected behavior

In some countries, it's hard to access the default CDN. So I want to specify a self-hosted pyodide CDN as well as a PyPI url.

Context

  • JupyterLite version: 0.3.0
  • Operating System and version: Windows 11 / Ubuntu latest
Build Output
[LiteBuildApp] No archive (yet): jupyterlite-jupyterlite.tgz
[LiteBuildApp]     jupyter-lite.(json|ipynb): 1 files
/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/jupyterlite_core/addons/base.py:294: UserWarning: install libarchive-c for better performance when working with archives: No module named 'libarchive'
  return has_optional_dependency(
static:jupyter-lite.json
.  pre_status:static:jupyter-lite.json
    tarball:         jupyterlite-app-0.3.0.tgz 13MB
    output:          /home/runner/work/jupyterlite/jupyterlite/dist
    lite dir:        /home/runner/work/jupyterlite/jupyterlite
    apps:            
    sourcemaps:      True
    unused packages: True
archive:archive
contents:contents
icons:icons
jupyterlite-pyodide-kernel-pyodide:pyodide
lite:jupyter-lite.json
mimetypes:jupyter-lite.json
serve:contents
settings:overrides
translation:translation
.  status:archive:archive
.  status:contents:contents
    contents: [25](https://github.com/promplate/jupyterlite/actions/runs/10059802261/job/27805847873#step:5:26) files
.  status:icons:icons
    favicon files: 0 files
.  status:jupyterlite-pyodide-kernel-pyodide:pyodide
     URL: https://cdn.promplate.dev/pyodide/v0.[26](https://github.com/promplate/jupyterlite/actions/runs/10059802261/job/27805847873#step:5:27).1/pyodide.js
 archive: []
   cache: 0 files
   local: 0 files
.  status:lite:jupyter-lite.json
.  status:mimetypes:jupyter-lite.json
    filetypes:         26 
.  status:serve:contents
    url: http://1[27](https://github.com/promplate/jupyterlite/actions/runs/10059802261/job/27805847873#step:5:28).0.0.1:8000/
    server: tornado
    headers:
.  status:settings:overrides
    overrides.json: 0
.  status:translation:translation
    translation files: 0 files
static:output_dir
.  pre_init:static:output_dir
static:unpack
.  init:static:unpack
jupyterlite-pyodide-kernel-pyodide:fetch:pyodide.js
.  post_init:jupyterlite-pyodide-kernel-pyodide:fetch:pyodide.js
federated_extensions:copy:ext:jupyterlab-night
federated_extensions:copy:ext:ipyevents
federated_extensions:copy:ext:jupyterlab_pygments
federated_extensions:copy:ext:jupyterlab-plotly
federated_extensions:copy:ext:jupyter-leaflet
federated_extensions:copy:ext:ipycanvas
federated_extensions:copy:ext:bqplot
federated_extensions:copy:ext:jupyter-matplotlib
federated_extensions:copy:ext:@jupyter-widgets/jupyterlab-manager
federated_extensions:copy:ext:@jupyterlite/pyodide-kernel-extension
federated_extensions:copy:ext:@jupyterlite/p5-kernel-extension
federated_extensions:copy:ext:@jupyterlite/javascript-kernel-extension
federated_extensions:copy:ext:@jupyter-notebook/lab-extension
federated_extensions:copy:ext:@timkpaine/jupyterlab_miami_nights
federated_extensions:copy:ext:@jupyterlab/geojson-extension
federated_extensions:copy:ext:@jupyterlab/fasta-extension
.  pre_build:federated_extensions:copy:ext:jupyterlab-night
.  pre_build:federated_extensions:copy:ext:ipyevents
.  pre_build:federated_extensions:copy:ext:jupyterlab_pygments
.  pre_build:federated_extensions:copy:ext:jupyterlab-plotly
.  pre_build:federated_extensions:copy:ext:jupyter-leaflet
.  pre_build:federated_extensions:copy:ext:ipycanvas
.  pre_build:federated_extensions:copy:ext:bqplot
.  pre_build:federated_extensions:copy:ext:jupyter-matplotlib
.  pre_build:federated_extensions:copy:ext:@jupyter-widgets/jupyterlab-manager
.  pre_build:federated_extensions:copy:ext:@jupyterlite/pyodide-kernel-extension
.  pre_build:federated_extensions:copy:ext:@jupyterlite/p5-kernel-extension
.  pre_build:federated_extensions:copy:ext:@jupyterlite/javascript-kernel-extension
.  pre_build:federated_extensions:copy:ext:@jupyter-notebook/lab-extension
.  pre_build:federated_extensions:copy:ext:@timkpaine/jupyterlab_miami_nights
.  pre_build:federated_extensions:copy:ext:@jupyterlab/geojson-extension
.  pre_build:federated_extensions:copy:ext:@jupyterlab/fasta-extension
contents:copy:README.md
contents:copy:data/Museums_in_DC.geojson
contents:copy:data/bar.vl.json
contents:copy:data/fasta-example.fasta
contents:copy:data/iris.csv
contents:copy:data/matplotlib.png
contents:copy:javascript.ipynb
contents:copy:p5.ipynb
contents:copy:pyodide/altair.ipynb
contents:copy:pyodide/folium.ipynb
contents:copy:pyodide/interactive-widgets.ipynb
contents:copy:pyodide/ipycanvas.ipynb
contents:copy:pyodide/ipyleaflet.ipynb
contents:copy:pyodide/matplotlib.ipynb
contents:copy:pyodide/plotly.ipynb
contents:copy:pyodide/pyb2d/0_tutorial.ipynb
contents:copy:pyodide/pyb2d/color_mixing.ipynb
contents:copy:pyodide/pyb2d/games/angry_shapes.ipynb
contents:copy:pyodide/pyb2d/games/billiard.ipynb
contents:copy:pyodide/pyb2d/games/goo.ipynb
contents:copy:pyodide/pyb2d/games/rocket.ipynb
contents:copy:pyodide/pyb2d/gauss_machine.ipynb
contents:copy:pyodide/pyb2d/newtons_cradle.ipynb
contents:copy:pyodide/renderers.ipynb
contents:copy:python.ipynb
icons:copy
jupyterlite-pyodide-kernel-pyodide:copy:pyodide
lite:patch:repl/jupyter-lite.json
translation:copy
.  build:contents:copy:README.md
.  build:contents:copy:data/Museums_in_DC.geojson
.  build:contents:copy:data/bar.vl.json
.  build:contents:copy:data/fasta-example.fasta
.  build:contents:copy:data/iris.csv
.  build:contents:copy:data/matplotlib.png
.  build:contents:copy:javascript.ipynb
.  build:contents:copy:p5.ipynb
.  build:contents:copy:pyodide/altair.ipynb
.  build:contents:copy:pyodide/folium.ipynb
.  build:contents:copy:pyodide/interactive-widgets.ipynb
.  build:contents:copy:pyodide/ipycanvas.ipynb
.  build:contents:copy:pyodide/ipyleaflet.ipynb
.  build:contents:copy:pyodide/matplotlib.ipynb
.  build:contents:copy:pyodide/plotly.ipynb
.  build:contents:copy:pyodide/pyb2d/0_tutorial.ipynb
.  build:contents:copy:pyodide/pyb2d/color_mixing.ipynb
.  build:contents:copy:pyodide/pyb2d/games/angry_shapes.ipynb
.  build:contents:copy:pyodide/pyb2d/games/billiard.ipynb
.  build:contents:copy:pyodide/pyb2d/games/goo.ipynb
.  build:contents:copy:pyodide/pyb2d/games/rocket.ipynb
.  build:contents:copy:pyodide/pyb2d/gauss_machine.ipynb
.  build:contents:copy:pyodide/pyb2d/newtons_cradle.ipynb
.  build:contents:copy:pyodide/renderers.ipynb
.  build:contents:copy:python.ipynb
.  build:icons:copy
.  build:jupyterlite-pyodide-kernel-pyodide:copy:pyodide
TaskError - taskid:build:jupyterlite-pyodide-kernel-pyodide:copy:pyodide
PythonAction Error
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/doit/action.py", line 461, in execute
    returned_value = self.py_callable(*self.args, **kwargs)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/jupyterlite_core/addons/base.py", line 89, in copy_one
    shutil.copy2(src, dest)
  File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/shutil.py", line [44](https://github.com/promplate/jupyterlite/actions/runs/10059802261/job/27805847873#step:5:45)8, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/shutil.py", line 256, in copyfile
    with open(src, 'rb') as fsrc:
         ^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/home/runner/work/jupyterlite/jupyterlite/.cache/pyodide/pyodide/pyodide'

It should be a URL to a tarball instead of the JS file: https://github.com/jupyterlite/pyodide-kernel?tab=readme-ov-file#usage

Otherwise, you may be able to use a jupyter-lite.json config file to provide the custom URL: https://jupyterlite.readthedocs.io/en/latest/howto/pyodide/pyodide.html#using-a-custom-pyodide-distribution

Thanks! I will try it. Looks like the latter one fits me better.