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

Consider switching the default renderer to one that supports offline renderering #2797

Closed
joelostblom opened this issue Jan 3, 2023 · 5 comments

Comments

@joelostblom
Copy link
Contributor

joelostblom commented Jan 3, 2023

Maybe when Jupyter Notebook's release v7 is out, which is based on jupyterlab, it makes sense to switch the default renderer to one that support offline rendering? This is not the highest priority right now, but I thought I would record the idea. Maybe we could also trim down the amount of available renderers to simplify the selection a bit (at least html and default are the same, maybe also jupyterlab and mimetype?). Based on the discussion here vega/vegafusion#204 (reply in thread)

@jonmmease
Copy link
Contributor

I'll also note that when I was testing renderers for VegaFusion, it looks like the default "html" renderer now works fine in Colab and Kaggle, so we may not need to specialized versions anymore.

@joelostblom
Copy link
Contributor Author

Another related topic is to bring the vega and vega-lite javascript for offline rendering into altair instead of having it in altair_viewer as discussed in #2807 and #2765.

@ChristopherDavisUCI
Copy link
Contributor

Are there any subtleties I might be missing related to using alt.renderers.enable("mimetype")? I believe I'm on the master branch of Altair and am using JupyterLab 3.5.2. If I try for example the following:

import altair as alt
alt.renderers.enable("mimetype")
alt.Chart().mark_point()

I get the following message

<VegaLite 5 object>

If you see this message, it means the renderer has not been properly enabled
for the frontend that you are using. For more information, see
https://altair-viz.github.io/user_guide/troubleshooting.html

I have tried running the following command from the terminal:

jupyter labextension install @jupyterlab/vega5-extension

@jakevdp
Copy link
Collaborator

jakevdp commented Jan 6, 2023

Some history here: originally, mimetype/jupyterlab was the default renderer. This proved problematic for several reasons:

  • not all notebook platforms supporte mimetype-based rendering, which meant users had to enable non-default renderers in classic notebook, kaggle, streamlit, etc.
  • mimetype rendering requires your lab extension to match the Altair version, otherwise your chart just says <VegaLite 5 object> as @ChristopherDavisUCI found. By design, the lab extension version cannot be controlled by the Altair package, or anything within the python runtime, but rather by the jupyter server. This makes it frustrating and difficult to debug when things go wrong. Every time we did a new Altair release with a new vega-lite, we dealt with several months of users who found that their charts no longer displayed because they didn't know how to update jupyterlab extensions (and usually didn't even know what a jupyterlab extension was, or how to check what versions they had or how to install new ones!). Additionally, the new vega-lite versions were not always available yet as a lab extension, so users were unable to use Altair in JupyterLab until the Jupyter team released a new extension, which sometimes took several weeks.

The default mimetype renderer probably caused the biggest support burden of anything in the Altair package.

Eventually, we managed to create an HTML renderer that basically worked everywhere (not a small feat given how vega-lite is packaged with respect to its interaction with requirejs), with the main downside being that it requires web access. Switching to that greatly reduced the number of user questions about rendering charts on various notebook platforms.

Offline rendering is great when it works, but mostly it doesn't work (as @ChristopherDavisUCI is finding above) and I think going back to that as a default would be a mistake.

@joelostblom
Copy link
Contributor Author

Thanks for that historical context @jakevdp. I will close this issue then.

It seems like it could still be beneficial to remove some of the redundant renderer aliases, so I opened #2821 for that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants