-
Notifications
You must be signed in to change notification settings - Fork 795
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
Support for JupyterLite is missing for JupyterChart
component
#3409
Comments
Huh, I had never tried JupyerChart in JupyterLite, so I'm not sure whether this is a regression. @manzt, would you expect an AnyWidget to work in JupyterLite? |
Hi there, this is a fundamental challenge with traditional Jupyter widgets (which anywidget is). In order to use a widget, the JS code must discoverable in the Jupyter environment which running the Jupyter server. In your case, JupyterLite was compiled with one version of anywidget, and then Since there is a version mismatch between the Python anywidget version (user Python env) and the JS anywidget version (env running Jupyter server), this opaque error appears. I've been scratching my head on this for a bit because it is by far the most frustrating thing for end users, but is so fundamentally tied to a design decision to have widget JS assets in Jupyter discoverable as extensions rather than the userland kernel. For Google Colab and VS Code, the anywidget JS is loaded from a CDN. I personally think this should also be the case in JupyterLite. However, a better solution would be to allow widget code to be discovered from the kernel.
TL;DR await micropip.install(["altair", "anywidget==<whatever-versionn-jupyterlite-is-using>"]) as a workaround, but this is something I'm hoping to address maybe at the SciPy sprints this summer. |
Thanks @manzt! I understand this can be frustrating. We might be able to extend this to assist users with a readable code explaining the context around these anywidget-jupyterlite peculiarities (less is better, but nothing wrong with it for the time being!). So if I understand right, in JupyterLite if we get this:
If I run |
Unfortunately, not that I'm aware of. This error comes up when either anywidget isn't installed in the jupyter env or there is a version mismatch. Either way, anywidget never gets a chance to run any code, and therefore the |
Thanks for the context @manzt. We always appreciate it! |
What happened?
I tried to run the following code in JupyterLite, https://jupyter.org/try-jupyter/lab/:
But it returns the following error:
I can't remember if this is broken now or if it was always like this.
What would you like to happen instead?
The same as what is being shown here: https://altair-viz.github.io/user_guide/jupyter_chart.html#basic-usage
Which version of Altair are you using?
5.3.0
The text was updated successfully, but these errors were encountered: