perspective icon indicating copy to clipboard operation
perspective copied to clipboard

[VSCode] Unable to find widget '@finos/perspective-jupyterlab'

Open steovd opened this issue 5 months ago • 1 comments

Bug Report

PerspectiveWidget doesn't work in VSCode because the Jupyter extension cannot find widget frontend scripts in @finos/perspective-jupyterlab.

Steps to Reproduce:

  1. Install Jupyter and Python VSCode extensions.
  2. Open a notebook, select a kernel that has perspective-python installed.
  3. Try to display a PerspectiveWidget instance.
    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-python globally, it didn't help.

  • From what was said in https://github.com/microsoft/vscode-jupyter/issues/12763#issuecomment-1445489782, I believe that this issue is caused by how @finos/perspective-jupyterlab is packaged and distributed. Looking at https://www.jsdelivr.com/package/npm/@finos/perspective-jupyterlab?tab=files, the dist/ 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.

steovd avatar Jul 28 '25 11:07 steovd

From my experience, it has basically never worked in Notebooks in VSCode -- not just that something broke it recently.

It’s also not usable in Notebooks on Databricks.

Please find attached examples with error messages below.


VSCODE

Editor: Image

Notification: Image

Error message: Unable to find widget '@finos/perspective-jupyterlab' version '~3.7.4' from configured widget sources ["jsdelivr.com","unpkg.com"]. Expected behavior may be affected. Click [here](https://aka.ms/PVSCIPyWidgets) for more information.

DATABRICKS

Image

Error message: Could not load module @finos/perspective-jupyterlab from https://cdn.jsdelivr.net/npm/@finos/perspective-jupyterlab@~3.7.4/dist/index.js. The widget author may have not published the widget JavaScript or there may have been a network error.

TEST CODE

Cell 1:

from datetime import date, datetime
import numpy as np
import pandas as pd
import perspective

data = pd.DataFrame({
    "int": np.arange(100),
    "float": [i * 1.5 for i in range(100)],
    "bool": [True for i in range(100)],
    "date": [date.today() for i in range(100)],
    "datetime": [datetime.now() for i in range(100)],
    "string": [str(i) for i in range(100)]
})

table = perspective.table(data, index="float")
display(table)

Cell 2:

w = PerspectiveWidget(
    data,
    plugin="X Bar",
    aggregates={"datetime": "any"},
    sort=[["date", "desc"]]
)

display(w)

auriz24 avatar Aug 19 '25 08:08 auriz24