-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
Bug Report
PerspectiveWidget doesn't work in VSCode because the Jupyter extension cannot find widget frontend scripts in @finos/perspective-jupyterlab.
Steps to Reproduce:
- Install Jupyter and Python VSCode extensions.
- Open a notebook, select a kernel that has
perspective-pythoninstalled. - Try to display a
PerspectiveWidgetinstance.import polars as pl from perspective.widget import PerspectiveWidget display(PerspectiveWidget(pl.DataFrame({"x": range(5), "y": range(5)})))
Expected Result:
The widget shows and works.
Actual Result:
-
In the cell's output, instead of the widget, a JS error is displayed, saying that the widget class could not be found. I'm paraphrasing because the error message shown was truncated and I didn't bother digging it up from logs as the cause seems clear (explained below).
-
VSCode displays this popup:
Unable to find widget '@finos/perspective-jupyterlab' version '~3.6.1' from configured widget sources ["jsdelivr.com","unpkg.com"]. Expected behavior may be affected. Click here for more information.
-
In the Output view (View > Output), Jupyter logs contain:
12:39:49.139 [error] Widget Error: Failed to access CDN https://unpkg.com/ after 0 attempt(s), TypeError: Failed to fetch 12:39:55.220 [error] Widget Script @finos/perspective-jupyterlab#~3.6.1 was not found on on any cdn 12:39:55.220 [warn] Widget Script Source not found for @finos/perspective-jupyterlab@~3.6.1 from cdn 12:39:55.221 [warn] Widget Script Source not found for @finos/perspective-jupyterlab@~3.6.1 from local 12:39:55.221 [error] Script source for Widget @finos/perspective-jupyterlab@~3.6.1 not found in cdn, local 12:39:55.240 [error] Widget load failure {} [ 'jsdelivr.com', 'unpkg.com' ] { classNa<username>: 'PerspectiveModel', moduleNa<username>: '@finos/perspective-jupyterlab', moduleVersion: '~3.6.1', isOnline: true, ti<username>dout: false, error: '{}' }
Environment:
- Arch Linux
- VSCodium (1.102.14746)
- CPython 3.12.8
Additional Context:
-
I also tried installing
perspective-pythonglobally, it didn't help. -
From what was said in Unable to find widget 'catboost-widget' from configured widget sources microsoft/vscode-jupyter#12763 (comment), I believe that this issue is caused by how
@finos/perspective-jupyterlabis packaged and distributed. Looking at https://www.jsdelivr.com/package/npm/@finos/perspective-jupyterlab?tab=files, thedist/folder is indeed missing. -
Other widget labextensions work fine. To list a few: anywidget, jupyter-vuetify. They all package their files under
dist/. -
Based on how widget loading issues are being handed by vscode-jupyter maintainers, it seems they believe that these issues are to blame on the widget packages rather than their extension. I don't know enough about extension development for either VSCode or JupyterLab to comment on that.