altair icon indicating copy to clipboard operation
altair copied to clipboard

Mimetype renderer not working

Open joelostblom opened this issue 2 years ago • 1 comments

The mimetype renderer seems to not be working with the current development version of Altair (tested on JupyterLab 3.2.8):

import altair as alt


alt.renderers.enable('mimetype')

data = alt.Data(values=[{'x': 'A', 'y': 5},
                        {'x': 'B', 'y': 3},
                        {'x': 'C', 'y': 6},
                        {'x': 'D', 'y': 7},
                        {'x': 'E', 'y': 2}])
alt.Chart(data).mark_bar().encode(
    x='x:O',
    y='y:Q',
)
<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

joelostblom avatar Mar 30 '22 15:03 joelostblom

You would need a vega-lite 5 extension installed on either jupyterlab or notebook, and I don't think that exists yet for either frontend. It's also hard to create it before releasing the v5 of the package, because then users who pip install the latest version will no longer be able to view Altair v4 charts.

These are some of the many reasons we moved away from using the mime-based rendering by default.

jakevdp avatar Mar 30 '22 17:03 jakevdp

Once https://github.com/jupyterlab/jupyterlab/pull/13893 is merged, this issue can be closed

mattijn avatar Feb 05 '23 08:02 mattijn

This functionality was merged into JupyterLab, thanks @ChristopherDavisUCI !

Before closing this issue, do you think we need to communicate the minimum version of JuptyerLab that support Altair 5 somewhere? I am thinking ideally directly in the error message if possible, but otherwise at least in the docs and release notes, what do you all think?

joelostblom avatar Feb 06 '23 19:02 joelostblom

Thanks @joelostblom! I'm not sure yet which version of JupyterLab will include this fix, but I'll try to remember to keep an eye on the releases (and let me know if you notice it). I do think a custom error message should be doable.

ChristopherDavisUCI avatar Feb 06 '23 21:02 ChristopherDavisUCI

Seems like the release of JupyterLab 4 will be around early - mid May https://github.com/jupyterlab/jupyterlab/issues/9647#issuecomment-1477595330

joelostblom avatar Mar 22 '23 14:03 joelostblom

Jupyterlab 4 is out and the mimetype renderer works for Altair 5 🥳 Great work @ChristopherDavisUCI! I created #3070 to track the idea by @joelostblom to extend the error message.

binste avatar May 27 '23 06:05 binste