panel icon indicating copy to clipboard operation
panel copied to clipboard

Pyodide in docs not working:

Open MarcSkovMadsen opened this issue 1 year ago • 6 comments

I just tried to run pyodide in the page https://panel.holoviz.org/tutorials/basic/build_streaming_dashboard.html.

I never loads. And it never tells the user why it does not load.

When inspecting the browser console I see

Error: [Service Worker] Fetching resource https://cdn.holoviz.org/panel/1.4.5/dist/wheels/bokeh-3.4.2-py3-none-any.whl failed with response: 403
    at PyodideServiceWorker.js:51:13

It seems it tries to load https://cdn.holoviz.org/panel/1.4.5/dist/wheels/bokeh-3.4.2-py3-none-any.whl and that this file does not exist.

I also see

pyodide.asm.js:9 
 Uncaught (in promise) 
PythonError: Traceback (most recent call last):
  File "/lib/python3.11/site-packages/micropip/transaction.py", line 82, in _fetch_bytes
    return await fetch_bytes(self.url, fetch_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.11/site-packages/micropip/_compat_in_pyodide.py", line 30, in fetch_bytes
    result_bytes = await (await pyfetch(url, **kwargs)).bytes()
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python311.zip/pyodide/http.py", line 309, in pyfetch
    raise OSError(e.message) from None
OSError: Failed to fetch

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/lib/python311.zip/_pyodide/_base.py", line 573, in eval_code_async
    await CodeRunner(
  File "/lib/python311.zip/_pyodide/_base.py", line 395, in run_async
    await coroutine
  File "<exec>", line 2, in <module>
  File "/lib/python3.11/site-packages/micropip/_commands/install.py", line 142, in install
    await transaction.gather_requirements(requirements)
  File "/lib/python3.11/site-packages/micropip/transaction.py", line 204, in gather_requirements
    await asyncio.gather(*requirement_promises)
  File "/lib/python3.11/site-packages/micropip/transaction.py", line 217, in add_requirement
    await self.add_wheel(wheel, extras=set(), specifier="")
  File "/lib/python3.11/site-packages/micropip/transaction.py", line 383, in add_wheel
    await wheel.download(self.fetch_kwargs)
  File "/lib/python3.11/site-packages/micropip/transaction.py", line 98, in download
    data = await self._fetch_bytes(fetch_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.11/site-packages/micropip/transaction.py", line 90, in _fetch_bytes
    raise ValueError(
ValueError: Can't fetch wheel from 'https://cdn.holoviz.org/panel/1.4.5/dist/wheels/bokeh-3.4.2-py3-none-any.whl'. One common reason for this is when the server blocks Cross-Origin Resource Sharing (CORS). Check if the server is sending the correct 'Access-Control-Allow-Origin' header.

    at new_error (pyodide.asm.js:9:10014)
    at pyodide.asm.wasm:0x158e62
    at pyodide.asm.wasm:0x15ff9e
    at _PyEM_TrampolineCall_JS (pyodide.asm.js:9:120223)
    at pyodide.asm.wasm:0x1a3494
    at pyodide.asm.wasm:0x28a2bd
    at pyodide.asm.wasm:0x1e431e
    at pyodide.asm.wasm:0x1a397d
    at pyodide.asm.wasm:0x1a3c3e
    at pyodide.asm.wasm:0x1a3ce0
    at pyodide.asm.wasm:0x2689a4
    at pyodide.asm.wasm:0x26e800
    at pyodide.asm.wasm:0x1a3e08
    at pyodide.asm.wasm:0x1a3a98
    at pyodide.asm.wasm:0x15f76b
    at Module.callPyObjectKwargs (pyodide.asm.js:9:64297)
    at Module.callPyObject (pyodide.asm.js:9:65365)
    at wrapper (pyodide.asm.js:9:32855)

MarcSkovMadsen avatar Aug 05 '24 13:08 MarcSkovMadsen

Hmm, not sure why it's still using those longer URLs. Just copied the bokeh wheel into that location (you may have to clear your cache once) but in future it should always load these from https://cdn.holoviz.org/panel/wheels/.

philippjfr avatar Aug 05 '24 13:08 philippjfr

I did a hard refresh. Now there is another issue when clicking the pyodide run button.

image

MarcSkovMadsen avatar Aug 05 '24 15:08 MarcSkovMadsen

I tried this site https://panel.holoviz.org/tutorials/basic/build_animation.html

There I get

Access to fetch at 'https://assets.holoviz.org/panel/tutorials/turbines.csv.gz' from origin 'https://panel.holoviz.org' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

MarcSkovMadsen avatar Aug 05 '24 15:08 MarcSkovMadsen

Can't reproduce.

philippjfr avatar Aug 05 '24 15:08 philippjfr

Oops, yes, I can.

philippjfr avatar Aug 05 '24 15:08 philippjfr

Not sure why it's loading data from there in the first place, all datasets should come from https://datasets.holoviz.org

philippjfr avatar Aug 05 '24 15:08 philippjfr

Fixed, though there's some funkiness with the button(s) that I just resolved.

philippjfr avatar Sep 09 '24 11:09 philippjfr

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Sep 09 '25 16:09 github-actions[bot]