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

Perspective 1.0.2 and above does not work in Voila #1773

Closed
moiney opened this issue Mar 21, 2022 · 15 comments
Closed

Perspective 1.0.2 and above does not work in Voila #1773

moiney opened this issue Mar 21, 2022 · 15 comments
Assignees
Labels
bug Concrete, reproducible bugs Jupyter

Comments

@moiney
Copy link

moiney commented Mar 21, 2022

Bug Report

Steps to Reproduce:

  1. Open a Jupyter notebook that uses PerspectiveWidget in Jupyterlab, where it renders correctly.
  2. Render the same notebook using Voila.

Expected Result:

Working PerspectiveWidget instances.

Actual Result:

PerspectiveWidget can not be registered in Voila.
image

Environment:

Perspective > 1.0.1, Any OS, Voila 0.3.3 (same version for preview)

Additional Context:

Perspective Jupyterlab is now bundled as an ECMAScript module, and can not be loaded through requireJs into Voila.
This is related to #1611

@texodus
Copy link
Member

texodus commented Mar 27, 2022

@finos/perspective-jupyterlab is not bundled as an ECMAScript module - it uses the esbuild "esm" format but this is an implementation detail as the bundle contains no import nor export statements.

From the error screenshot, it looks like Voila is trying to load the plugin from CDN and using the wrong path (dist vs dist/umd as per the package.json main field). @timkpaine is this a Voila gotcha?

@timkpaine
Copy link
Member

i can probably update voila to check for the main of the package.json

@texodus
Copy link
Member

texodus commented Mar 27, 2022

May be a bit more complex than that, as the general rules for module resolution are somewhat arbitrary (e.g. jsdelivr also respects a jsdelivr field when present, and newer versions introduce exports etc).

The error seems to indicate fetching from a CDN is an exception rather than the norm - would this be resolved by disting the plugin with perspective-python?

@texodus
Copy link
Member

texodus commented Mar 27, 2022

If I just change the output location to dist, this will work I assume?

@timkpaine
Copy link
Member

#467

@timkpaine
Copy link
Member

#442

@timkpaine
Copy link
Member

original: #335

@moiney
Copy link
Author

moiney commented Mar 28, 2022

Not sure switching the output to a dist/index.js would solve the issue.

We can configure require for voila to fetch the asset from the valid path :
requirejs.config({ paths: { '@finos/perspective-jupyterlab': 'https://cdn.jsdelivr.net/npm/@finos/[email protected]/dist/umd/perspective-jupyterlab' } });

Then we get the below error in the console.
image

@th3darkang3l
Copy link

Same problem here, Perspective is working fine through JupyterLab, but inside Voila he is trying to get dist/index.js from CDN and it's no loger available since 1.0.2 .

What I tried is to pass option enable_nbextensions=True to Voila, hoping that it could retrieve perspective-jupyterlab.js from local disk but it didn't work..

image

I can locate the file in /usr/local/share/jupyter/lab/staging/node_modules/@finos/perspective-jupyterlab/dist/umd/perspective-jupyterlab.js surely because I installed labextension (the npm part) and rebuilt jupyter, but voila doesn't seems to find it.

Anyone did find a working solution? In meanwhile I'll be stick with the 1.0.1 ...

@timkpaine
Copy link
Member

There is no workaround, we can fix the cdn location but the best solution is for me to finish the prebuilt extension which will let it find perspective on disk.

@wangkev
Copy link

wangkev commented Aug 31, 2022

Has there been any progress on this ticket?

@scp871
Copy link

scp871 commented Nov 2, 2022

@timkpaine Is resolution of this issue waiting on approval of your PR for voila issue 1154?

@maxrausch
Copy link

Any updates here?

@timkpaine
Copy link
Member

should work after #2136

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Concrete, reproducible bugs Jupyter
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants