not working with VegaFusionWidget: Error: [object ArrayBuffer] is not serializable
MarcSkovMadsen opened this issue · comments
Panel: 0.12.6 vegafusion-jupyter: 0.0.2 vega-datasets 0.9.0 ipywidgets-bokeh 1.2.1
I'm trying to use the VegaFusionWidget ipywidget with Panel. See vega/vegafusion#62. But its raising the error below.
pip install panel vegafusion-jupyter vega-datasets ipywidgets_bokeh
import panel as pn
import altair as alt
from vega_datasets import data
pn.extension("ipywidgets", template="fast")
from vegafusion_jupyter import VegaFusionWidget
ACCENT = "#1f77b4"
PALETTE = [ACCENT, "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf"]
if not "panel-vegafusion" in pn.state.cache:
seattle_weather = pn.state.cache["panel-vegafusion"]=data.seattle_weather()
else:
seattle_weather = pn.state.cache["panel-vegafusion"]
def get_chart(seattle_weather):
brush = alt.selection(type='interval', encodings=['x'])
bars = alt.Chart().mark_bar().encode(
x='month(date):O',
y='mean(precipitation):Q',
opacity=alt.condition(brush, alt.OpacityValue(1), alt.OpacityValue(0.7)),
).add_selection(
brush
)
line = alt.Chart().mark_rule(color='firebrick').encode(
y='mean(precipitation):Q',
size=alt.SizeValue(3)
).transform_filter(
brush
)
return alt.layer(bars, line, data=seattle_weather)
chart = get_chart(seattle_weather)
vchart = VegaFusionWidget(chart)
pn.pane.IPyWidget(vchart).servable()
pn.state.template.param.update(
site="Vegafusion", title="Interactive Big Data Apps with Crossfiltering",
accent_base_color=ACCENT, header_background=ACCENT
)
$ panel serve 'panel_vegafusion_app.py'
2022-01-28 01:59:38,588 Starting Bokeh server version 2.4.2 (running on Tornado 6.1)
2022-01-28 01:59:38,596 User authentication hooks NOT provided (default user enabled)
2022-01-28 01:59:38,601 Bokeh app running at: http://localhost:5006/panel_vegafusion_app
2022-01-28 01:59:38,602 Starting Bokeh server with process id: 18208
---------SEND--------------
stream <ipywidgets_bokeh.kernel.WebsocketStream object at 0x0000029ABB811820>
msg_type comm_open
content {'data': {'state': {'_model_module': '@jupyter-widgets/base', '_model_module_version': '1.2.0', '_model_name': 'LayoutModel', '_view_count': None, '_view_module': '@jupyter-widgets/base', '_view_module_version': '1.2.0', '_view_name': 'LayoutView', 'align_content': None, 'align_items': None, 'align_self': None, 'border': None, 'bottom': None, 'display': None, 'flex': None, 'flex_flow': None, 'grid_area': None, 'grid_auto_columns': None, 'grid_auto_flow': None, 'grid_auto_rows': None, 'grid_column': None, 'grid_gap': None, 'grid_row': None, 'grid_template_areas': None, 'grid_template_columns': None, 'grid_template_rows': None, 'height': None, 'justify_content': None, 'justify_items': None, 'left': None, 'margin': None, 'max_height': None, 'max_width': None, 'min_height': None, 'min_width': None, 'object_fit': None,
'object_position': None, 'order': None, 'overflow': None, 'overflow_x': None, 'overflow_y': None, 'padding': None, 'right': None, 'top': None, 'visibility': None, 'width': None}, 'buffer_paths': []}, 'comm_id': 'b6744b8551fd4011b0546411cdaf1ba7', 'target_name': 'jupyter.widget', 'target_module': None}
parent {}
header None
metadata {'version': '2.0.0'}
data {"header": {"msg_id": "e1061adc-4bea603cc82aeb2970e4f28d_18208_0", "msg_type": "comm_open", "username": "username", "session": "e1061adc-4bea603cc82aeb2970e4f28d", "date": "2022-01-28T00:59:45.793502Z", "version": "5.3"}, "msg_id": "e1061adc-4bea603cc82aeb2970e4f28d_18208_0", "msg_type": "comm_open", "parent_header": {}, "content": {"data": {"state": {"_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display":
null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null,
"height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null}, "buffer_paths": []}, "comm_id": "b6744b8551fd4011b0546411cdaf1ba7", "target_name": "jupyter.widget", "target_module": null}, "metadata": {"version": "2.0.0"}, "channel": "iopub"}
---------SEND--------------
stream <ipywidgets_bokeh.kernel.WebsocketStream object at 0x0000029ABB811820>
msg_type comm_open
content {'data': {'state': {'_dom_classes': (), '_model_module': 'vegafusion-jupyter', '_model_module_version': '^0.0.2', '_model_name': 'VegaFusionModel', '_view_count': None, '_view_module': 'vegafusion-jupyter', '_view_module_version': '^0.0.2', '_view_name': 'VegaFusionView', 'client_vega_spec': None, 'comm_plan': None, 'debounce_max_wait': 60.0, 'debounce_wait': 30.0, 'download_source_link': None, 'full_vega_spec': None, 'layout': 'IPY_MODEL_b6744b8551fd4011b0546411cdaf1ba7', 'server_vega_spec': None, 'spec': '{\n "config": {\n "view": {\n
"continuousWidth": 400,\n "continuousHeight": 300\n }\n },\n "layer": [\n {\n "mark": "bar",\n "encoding": {\n
"opacity": {\n "condition": {\n "value": 1,\n "selection": "selector001"\n },\n "value": 0.7\n },\n "x": {\n "field": "date",\n "timeUnit": "month",\n "type": "ordinal"\n },\n "y": {\n "aggregate": "mean",\n "field": "precipitation",\n "type": "quantitative"\n }\n },\n "selection": {\n "selector001": {\n "type": "interval",\n "encodings": [\n "x"\n ]\n
}\n }\n },\n {\n "mark": {\n "type": "rule",\n "color": "firebrick"\n },\n "encoding": {\n
"size": {\n "value": 3\n },\n "y": {\n "aggregate": "mean",\n "field": "precipitation",\n
"type": "quantitative"\n }\n },\n "transform": [\n {\n "filter": {\n "selection": "selector001"\n }\n }\n ]\n }\n ],\n "data": {\n "url": "_vegafusion_data/vegafusion-7bd7f9dd903be78e727c1b52e745f4f17d1212dd.feather"\n },\n "$schema": "https://vega.github.io/schema/vega-lite/v4.17.0.json"\n}', 'verbose': False}, 'buffer_paths': []}, 'comm_id': '0582b62fd2c64638b4821fd5d8c4040d', 'target_name': 'jupyter.widget', 'target_module': None}
parent {}
header None
metadata {'version': '2.0.0'}
data {"header": {"msg_id": "e1061adc-4bea603cc82aeb2970e4f28d_18208_1", "msg_type": "comm_open", "username": "username", "session": "e1061adc-4bea603cc82aeb2970e4f28d", "date": "2022-01-28T00:59:45.799505Z", "version": "5.3"}, "msg_id": "e1061adc-4bea603cc82aeb2970e4f28d_18208_1", "msg_type": "comm_open", "parent_header": {}, "content": {"data": {"state": {"_dom_classes": [], "_model_module": "vegafusion-jupyter", "_model_module_version": "^0.0.2", "_model_name": "VegaFusionModel", "_view_count": null, "_view_module": "vegafusion-jupyter", "_view_module_version": "^0.0.2", "_view_name": "VegaFusionView", "client_vega_spec": null, "comm_plan": null, "debounce_max_wait": 60.0, "debounce_wait": 30.0, "download_source_link": null, "full_vega_spec": null, "layout": "IPY_MODEL_b6744b8551fd4011b0546411cdaf1ba7", "server_vega_spec": null, "spec": "{\n \"config\": {\n \"view\": {\n \"continuousWidth\": 400,\n \"continuousHeight\": 300\n }\n },\n \"layer\": [\n {\n \"mark\": \"bar\",\n \"encoding\": {\n \"opacity\": {\n \"condition\": {\n \"value\": 1,\n \"selection\": \"selector001\"\n },\n \"value\": 0.7\n },\n \"x\": {\n \"field\": \"date\",\n \"timeUnit\": \"month\",\n \"type\": \"ordinal\"\n },\n \"y\": {\n \"aggregate\": \"mean\",\n \"field\": \"precipitation\",\n \"type\": \"quantitative\"\n }\n },\n \"selection\": {\n
\"selector001\": {\n \"type\": \"interval\",\n \"encodings\": [\n \"x\"\n ]\n }\n }\n
},\n {\n \"mark\": {\n \"type\": \"rule\",\n \"color\": \"firebrick\"\n },\n \"encoding\": {\n \"size\": {\n \"value\": 3\n },\n \"y\": {\n \"aggregate\": \"mean\",\n \"field\": \"precipitation\",\n \"type\": \"quantitative\"\n }\n },\n \"transform\": [\n {\n \"filter\": {\n \"selection\": \"selector001\"\n }\n }\n ]\n }\n ],\n \"data\": {\n \"url\": \"_vegafusion_data/vegafusion-7bd7f9dd903be78e727c1b52e745f4f17d1212dd.feather\"\n },\n \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.17.0.json\"\n}", "verbose": false}, "buffer_paths": []}, "comm_id": "0582b62fd2c64638b4821fd5d8c4040d", "target_name": "jupyter.widget", "target_module": null}, "metadata": {"version": "2.0.0"}, "channel": "iopub"}
2022-01-28 01:59:46,288 WebSocket connection opened
2022-01-28 01:59:46,289 ServerConnection created
594.index.js:1
panicked at 'send_request function call failed: JsValue(Error: [object ArrayBuffer] is not serializable
Error: [object ArrayBuffer] is not serializable
at f.to_serializable (http://localhost:5006/static/js/bokeh.min.js?v=b3e0592a1e90448fa40dcddd5cd5217dcd6b3c7dd368020f6a8e4be4fdd1adbdeb2824eb75ab4f5120c80dc7684f8ff2aa2f8b00d6f393108c96d2f6f2cf0297:195:1391)
at l.[serialize] (http://localhost:5006/static/js/bokeh.min.js?v=b3e0592a1e90448fa40dcddd5cd5217dcd6b3c7dd368020f6a8e4be4fdd1adbdeb2824eb75ab4f5120c80dc7684f8ff2aa2f8b00d6f393108c96d2f6f2cf0297:200:458)
at f.to_serializable (http://localhost:5006/static/js/bokeh.min.js?v=b3e0592a1e90448fa40dcddd5cd5217dcd6b3c7dd368020f6a8e4be4fdd1adbdeb2824eb75ab4f5120c80dc7684f8ff2aa2f8b00d6f393108c96d2f6f2cf0297:195:1042)
at f.to_serializable (http://localhost:5006/static/js/bokeh.min.js?v=b3e0592a1e90448fa40dcddd5cd5217dcd6b3c7dd368020f6a8e4be4fdd1adbdeb2824eb75ab4f5120c80dc7684f8ff2aa2f8b00d6f393108c96d2f6f2cf0297:195:1169)
at E.create_json_patch (http://localhost:5006/static/js/bokeh.min.js?v=b3e0592a1e90448fa40dcddd5cd5217dcd6b3c7dd368020f6a8e4be4fdd1adbdeb2824eb75ab4f5120c80dc7684f8ff2aa2f8b00d6f393108c96d2f6f2cf0297:165:9308)
at r._document_changed (http://localhost:5006/static/js/bokeh.min.js?v=b3e0592a1e90448fa40dcddd5cd5217dcd6b3c7dd368020f6a8e4be4fdd1adbdeb2824eb75ab4f5120c80dc7684f8ff2aa2f8b00d6f393108c96d2f6f2cf0297:590:850)
at _document_listener (http://localhost:5006/static/js/bokeh.min.js?v=b3e0592a1e90448fa40dcddd5cd5217dcd6b3c7dd368020f6a8e4be4fdd1adbdeb2824eb75ab4f5120c80dc7684f8ff2aa2f8b00d6f393108c96d2f6f2cf0297:590:162)
at E._trigger_on_change (http://localhost:5006/static/js/bokeh.min.js?v=b3e0592a1e90448fa40dcddd5cd5217dcd6b3c7dd368020f6a8e4be4fdd1adbdeb2824eb75ab4f5120c80dc7684f8ff2aa2f8b00d6f393108c96d2f6f2cf0297:165:4698)
at gg.bk_send (http://localhost:5006/static/extensions/ipywidgets_bokeh/ipywidgets_bokeh.js?v=206620a657f1ccc8af72b866fdcef20e641c48f39ce27f338ce8313949c63e53:2:2745297)
at e.send (http://localhost:5006/static/extensions/ipywidgets_bokeh/ipywidgets_bokeh.js?v=206620a657f1ccc8af72b866fdcef20e641c48f39ce27f338ce8313949c63e53:2:2743285))', vegafusion-wasm/src/lib.rs:330:14
Stack:
Error
at Object.G (https://unpkg.com/vegafusion-jupyter@0.0.2/dist/594.index.js:1:7607)
at __wbg_new_693216e109162396 (https://unpkg.com/vegafusion-jupyter@%5E0.0.2/dist/index.js:1:22417)
at https://unpkg.com/vegafusion-jupyter@0.0.2/dist/d0048f4ff7544ce1ea76.module.wasm:wasm-function[2561]:0x3d8a32
at https://unpkg.com/vegafusion-jupyter@0.0.2/dist/d0048f4ff7544ce1ea76.module.wasm:wasm-function[5005]:0x4491e5
at https://unpkg.com/vegafusion-jupyter@0.0.2/dist/d0048f4ff7544ce1ea76.module.wasm:wasm-function[3646]:0x42ed5b
at https://unpkg.com/vegafusion-jupyter@0.0.2/dist/d0048f4ff7544ce1ea76.module.wasm:wasm-function[3935]:0x43bbbf
at https://unpkg.com/vegafusion-jupyter@0.0.2/dist/d0048f4ff7544ce1ea76.module.wasm:wasm-function[4371]:0x445b30
at https://unpkg.com/vegafusion-jupyter@0.0.2/dist/d0048f4ff7544ce1ea76.module.wasm:wasm-function[4417]:0x4463d7
at https://unpkg.com/vegafusion-jupyter@0.0.2/dist/d0048f4ff7544ce1ea76.module.wasm:wasm-function[3974]:0x43ceec
at https://unpkg.com/vegafusion-jupyter@0.0.2/dist/d0048f4ff7544ce1ea76.module.wasm:wasm-function[1422]:0x33ce35
nn @ 594.index.js:1
ipywidgets_bokeh.js?v=206620a657f1ccc8af72b866fdcef20e641c48f39ce27f338ce8313949c63e53:2
Error: Could not create a view for model id 0582b62fd2c64638b4821fd5d8c4040d
at ipywidgets_bokeh.js?v=206620a657f1ccc8af72b866fdcef20e641c48f39ce27f338ce8313949c63e53:2:2087124
(anonymous) @ ipywidgets_bokeh.js?v=206620a657f1ccc8af72b866fdcef20e641c48f39ce27f338ce8313949c63e53:2
ipywidgets_bokeh.js?v=206620a657f1ccc8af72b866fdcef20e641c48f39ce27f338ce8313949c63e53:2
Error: Could not create view
at ipywidgets_bokeh.js?v=206620a657f1ccc8af72b866fdcef20e641c48f39ce27f338ce8313949c63e53:2:2087124
at async gg.render (ipywidgets_bokeh.js?v=206620a657f1ccc8af72b866fdcef20e641c48f39ce27f338ce8313949c63e53:2:2744026)
at async _g._render (ipywidgets_bokeh.js?v=206620a657f1ccc8af72b866fdcef20e641c48f39ce27f338ce8313949c63e53:2:2744950)
(anonymous) @ ipywidgets_bokeh.js?v=206620a657f1ccc8af72b866fdcef20e641c48f39ce27f338ce8313949c63e53:2
2d0048f4ff7544ce1ea76.module.wasm:0x42ed91
Uncaught (in promise) RuntimeError: unreachable
at d0048f4ff7544ce1ea76.module.wasm:0x42ed91
at d0048f4ff7544ce1ea76.module.wasm:0x43bbbf
at d0048f4ff7544ce1ea76.module.wasm:0x445b30
at d0048f4ff7544ce1ea76.module.wasm:0x4463d7
at d0048f4ff7544ce1ea76.module.wasm:0x43ceec
at d0048f4ff7544ce1ea76.module.wasm:0x33ce35
at d0048f4ff7544ce1ea76.module.wasm:0x1714ab
at d0048f4ff7544ce1ea76.module.wasm:0x43abec
at d.J [as render_vegafusion] (594.index.js:1:4972)
at d.value_changed (index.js:1:14547)
Bokeh 3.0 will have much better support for binary messages so we may just get this for free.
@mattpap What do you think? Will your new serialization work allow serializing an ArrayBuffer embedded in some JSON object?
It does have bidirectional support for bytes <-> ArrayBuffer
serialization.
I just stumbled on this repo today, because I was working on a reboot of flask_ipywidgets and was curious how you people were doing some similar work (the code looks very similar 👀 ). My guess is that https://github.com/bokeh/ipywidgets_bokeh/blob/main/ipywidgets_bokeh/kernel.py#L71 has an issue when there is a memoryview object with a non-byte format. A .cast('b')
or using . nbytes
should work better instead of the len(..)
, not sure if that fixes this bug, but certainly an issue, and it which might fix #42 as well.
Thanks @maartenbreddels . I dont know the details by @philippjfr has said the next version of Bokeh will solve this issue.
Wanted to update this issue with the current behavior using the latest versions of the various libraries:
Versions:
ipywidgets-bokeh 1.4.0
panel 1.0.4
vegafusion-jupyter 1.3.0
vega-datasets 0.9.0
Example app: try_panel.py
import panel as pn
import ipywidgets as ipw
pn.extension('ipywidgets')
from vega_datasets import data
import altair as alt
import vegafusion as vf
source = alt.UrlData(
data.flights_2k.url,
format={'parse': {'date': 'date'}}
)
brush = alt.selection_interval(encodings=['x'])
# Define the base chart, with the common parts of the
# background and highlights
base = alt.Chart(width=160, height=130).mark_bar().encode(
x=alt.X(alt.repeat('column')).bin(maxbins=20),
y='count()'
)
# gray background with selection
background = base.encode(
color=alt.value('#ddd')
).add_params(brush)
# blue highlights on the transformed data
highlight = base.transform_filter(brush)
# layer the two charts & repeat
chart = alt.layer(
background,
highlight,
data=source
).transform_calculate(
"time",
"hours(datum.date)"
).repeat(column=["distance", "delay", "time"])
chart_widget = vf.jupyter.VegaFusionWidget(chart)
pn.panel(chart_widget).servable()
Run app:
panel serve try_panel.py --show
The window opens and the widgets loads successfully (as indicated by the VegaFusion logo being displayed). But an error occurs immediately after:
Browser trace:
[bokeh] Unhandled ERROR reply to 6D70744E946F4A24A7200D18588EFA20: UnicodeDecodeError('utf-32-be', b'\x00\x00\x00\x02\x00\x00\x00\x0c\x00\x00\x01\x83{"channel":"shell","content":{"comm_id":"7dcba7218edf4c34ae3228206ef4a839","data":{"method":"update","state":{},"buffer_paths":[["_request_msg"]]}},"header":{"date":"2023-06-04T21:48:12.772Z","msg_id":"c5cb3657-d9dd-4c9b-97f9-7f83e50b71da","msg_type":"comm_msg","session":"2f30d42e-36da-4ee6-af58-9ae46e2aa591","username":"","version":"5.2"},"metadata":{},"parent_header":{}}\n\xdc)\n\xaf)\n\xca\x01\n\xa6\x01\n\x0c\n\x08source_0\x10\x01*\x81\x01\nGhttps://cdn.jsdelivr.net/npm/vega-datasets@v1.29.0/data/flights-2k.json\x18\xa0?"\x16\n\x04json\x1a\x0e\n\x0c\n\x04date\x12\x04date*\x1b\n\x19R\x17\n\x04date\n\x05delay\n\x08distanceB\x12\n\x10America/New_York\x1a\x04\x08\x01\x10\x01\x1a\x04\x08\x03\x10\x01 \xd2\xc2\xa0\xcf\xf3\x94\x8a\xb7\xc6\x01(\x96\xec\x98\x8b\xcd\x91\xa2\x87\x14\n\xfb\x03\n\xd4\x03\n\n\n\x06data_6\x10\x012\xb1\x03\n\x08source_0\x12\xa4\x03\nD\x1aB\n::2\n\x05hours\x12)R!\n\x0f\n\x07\n\x05datumZ\x04\x08\x06\x10\x0b\x12\x0e\n\x06\n\x04dateZ\x04\x08\x0c\x10\x10Z\x04\x08\x0b\x10\x10Z\x04\x08\x05\x10\x11\x12\x04time\n?\x12=\n\x04time\x125child__column_time_layer_1_bin_maxbins_20_time_extent\n\xd1\x01"\xce\x01\n\x04time\x12=\n7\n5child__column_time_layer_1_bin_maxbins_20_time_extentZ\x02\x105\x1a3child__column_time_layer_1_bin_maxbins_20_time_bins"\x13bin_maxbins_20_time*\x17bin_maxbins_20_time_end9\x00\x00\x00\x00\x00\x004@A\x00\x00\x00\x00\x00\x00$@j\x10\x00\x00\x00\x00\x00\x00\x14@\x00\x00\x00\x00\x00\x00\x00@p\x01\nGRE\n\x13bin_maxbins_20_time\n\x17bin_maxbins_20_time_end\n\x05delay\n\x08distance\n\x04timeB\x12\n\x10America/New_York\x12\x00\x1a\x04\x08\n\x10\x01\x1a\x04\x08\x02\x10\x01 \x8f\xb0\x90\x91\xb5\xa8\xdd\xd2\xa3\x01(\xcf\xee\xee\x9d\xed\xa6\xa0\x8a\xfe\x01\n\xb2\x03\n\x96\x03\n\n\n\x06data_8\x10\x012\xf3\x02\n\x06data_6\x12\xe8\x02\n>*<\n\x13bin_maxbins_20_time\n\x17bin_maxbins_20_time_end\x12\x00\x1a\x07__count"\x01\x00\n\xea\x01\n\xe7\x01\n\xe4\x01"\xdb\x01\nd:\\\n\x07isValid\x12QRI\n\x0f\n\x07\n\x05datumZ\x04\x08\x08\x10\r\x124\x12,\n\x15"bin_maxbins_20_time"\x12\x13bin_maxbins_20_timeZ\x04\x08\x0e\x10#\x18\x01Z\x04\x08\r\x10$Z\x04\x08\x07\x10%\x10\x01\x1aq:i\n\x08isFinite\x12]*U\x10\x01\x1aQRI\n\x0f\n\x07\n\x05datumZ\x04\x083\x108\x124\x12,\n\x15"bin_maxbins_20_time"\x12\x13bin_maxbins_20_timeZ\x04\x089\x10N\x18\x01Z\x04\x088\x10OZ\x04\x082\x10OZ\x04\x081\x10PZ\x04\x08&\x10P\n9R7\n\x07__count\n\x13bin_maxbins_20_time\n\x17bin_maxbins_20_time_endB\x12\n\x10America/New_York\x12\x02\x08\x01 \xcf\x96\x81\xc7\xeb\xe1\xb3\xfe\xaa\x01(\xae\xd5\x85\xf0\xdd\xf6\xf1\xde+\n\xfe\x06\n\xd3\x06\n\n\n\x06data_0\x10\x012\xb0\x06\n\x08source_0\x12\xa3\x06\nB\x12@\n\x05delay\x127child__column_delay_layer_1_bin_maxbins_20_delay_extent\n\xd8\x01"\xd5\x01\n\x05delay\x12?
...
Python trace
2023-06-04 17:48:12,777 error handling message
message: Message 'PATCH-DOC' content: {'events': [{'kind': 'MessageSent', 'msg_type': 'ipywidgets_bokeh', 'msg_data': {'type': 'bytes', 'data': {'id': '0'}}}]}
error: UnicodeDecodeError('utf-32-be', b'\x00\x00\x00\x02\x00\x00\x00\x0c\x00\x00\x01\x83{"channel":"shell","content":{"comm_id":"7dcba7218edf4c34ae3228206ef4a839","data":{"method":"update","state":{},"buffer_paths":[["_request_msg"]]}},"header":{"date":"2023-06-04T21:48:12.772Z","msg_id":"c5cb3657-d9dd-4c9b-97f9-7f83e50b71da","msg_type":"comm_msg","session":"2f30d42e-36da-4ee6-af58-9ae46e2aa591","username":"","version":"5.2"},"metadata":{},"parent_header":{}}\n\xdc)\n\xaf)\n\xca\x01\n\xa6\x01\n\x0c\n\x08source_0\x10\x01*\x81\x01\nGhttps://cdn.jsdelivr.net/npm/vega-datasets@v1.29.0/data/flights-2k.json\x18\xa0?"\x16\n\x04json\x1a\x0e\n\x0c\n\x04date\x12\x04date*\x1b\n\x19R\x17\n\x04date\n\x05delay\n\x08distanceB\x12\n\x10America/New_York\x1a\x04\x08\x01\x10\x01\x1a\x04\x08\x03\x10\x01 \xd2\xc2\xa0\xcf\xf3\x94\x8a\xb7\xc6\x01(\x96\xec\x98\x8b\xcd\x91\xa2\x87\x14\n\xfb\x03\n\xd4\x03\n\n\n\x06data_6\x10\x012\xb1\x03\n\x08source_0\x12\xa4\x03\nD\x1aB\n::2\n\x05hours\x12)R!\n\x0f\n\x07\n\x05datumZ\x04\x08\x06\x10\x0b\x12\x0e\n\x06\n\x04dateZ\x04\x08\x0c\x10\x10Z\x04\x08\x0b\x10\x10Z\x04\x08\x05\x10\x11\x12\x04time\n?\x12=\n\x04time\x125child__column_time_layer_1_bin_maxbins_20_time_extent\n\xd1\x01"\xce\x01\n\x04time\x12=\n7\n5child__column_time_layer_1_bin_maxbins_20_time_extentZ\x02\x105\x1a3child__column_time_layer_1_bin_maxbins_20_time_bins"\x13bin_maxbins_20_time*\x17bin_maxbins_20_time_end9\x00\x00\x00\x00\x00\x004@A\x00\x00\x00\x00\x00\x00$@j\x10\x00\x00\x00\x00\x00\x00\x14@\x00\x00\x00\x00\x00\x00\x00@p\x01\nGRE\n\x13bin_maxbins_20_time\n\x17bin_maxbins_20_time_end\n\x05delay\n\x08distance\n\x04timeB\x12\n\x10America/New_York\x12\x00\x1a\x04\x08\n\x10\x01\x1a\x04\x08\x02\x10\x01 \x8f\xb0\x90\x91\xb5\xa8\xdd\xd2\xa3\x01(\xcf\xee\xee\x9d\xed\xa6\xa0\x8a\xfe\x01\n\xb2\x03\n\x96\x03\n\n\n\x06data_8\x10\x012\xf3\x02\n\x06data_6\x12\xe8\x02\n>*<\n\x13bin_maxbins_20_time\n\x17bin_maxbins_20_time_end\x12\x00\x1a\x07__count"\x01\x00\n\xea\x01\n\xe7\x01\n\xe4\x01"\xdb\x01\nd:\\\n\x07isValid\x12QRI\n\x0f\n\x07\n\x05datumZ\x04\x08\x08\x10\r\x124\x12,\n\x15"bin_maxbins_20_time"\x12\x13bin_maxbins_20_timeZ\x04\x08\x0e\x10#\x18\x01Z\x04\x08\r\x10$Z\x04\x08\x07\x10%\x10\x01\x1aq:i\n\x08isFinite\x12]*U\x10\x01\x1aQRI\n\x0f\n\x07\n\x05datumZ\x04\x083\x108\x124\x12,\n\x15"bin_maxbins_20_time"\x12\x13bin_maxbins_20_timeZ\x04\x089\x10N\x18\x01Z\x04\x088\x10OZ\x04\x082\x10OZ\x04\x081\x10PZ\x04\x08&\x10P\n9R7\n\x07__count\n\x13bin_maxbins_20_time\n\x17bin_maxbins_20_time_endB\x12\n\x10America/New_York\x12\x02\x08\x01 \xcf\x96\x81\xc7\xeb\xe1\xb3\xfe\xaa\x01(\xae\xd5\x85\xf0\xdd\xf6\xf1\xde+\n\xfe\x06\n\xd3\x06\n\n\n\x06data_0\x10\x012\xb0\x06\n\x08source_0\x12\xa3\x06\nB\x12@\n\x05delay\x127child__column_delay_layer_1_bin_maxbins_20_delay_extent\n\xd8\x01"\xd5\x01\n\x05delay\x12?\n9\n7child__column_delay_layer_1_bin_maxbins_20_delay_extentZ\x02\x107\x1a5child__column_delay_layer_1_bin_maxbins_20_delay_bins"\x14bin_maxbins_20_delay*\x18bin_maxbins_20_delay_end9\x00\x00\x00\x00\x00\x004@A\x00\x00\x00\x00\x00\x00$@j\x10\x00\x00\x00\x00\x00\x00\x14@\x00\x00\x00\x00\x00\x00\x00@p\x01\nK\x12I\n\x08distance\x12=child__column_distance_layer_1_bin_maxbins_20_distance_extent\n\xed\x01"\xea\x01\n\x08distance\x12E\n?\n=child__column_distance_layer_1_bin_maxbins_20_distance_extentZ\x02\x10=\x1a;child__column_distance_layer_1_bin_maxbins_20_distance_bins"\x17bin_maxbins_20_distance*\x1bbin_maxbins_20_distance_end9\x00\x00\x00\x00\x00\x004@A\x00\x00\x00\x00\x00\x00$@j\x10\x00\x00\x00\x00\x00\x00\x14@\x00\x00\x00\x00\x00\x00\x00@p\x01\nD\x1aB\n::2\n\x05hours\x12)R!\n\x0f\n\x07\n\x05datumZ\x04\x08\x06\x10\x0b\x12\x0e\n\x06\n\x04dateZ\x04\x08\x0c\x10\x10Z\x04\x08\x0b\x10\x10Z\x04\x08\x05\x10\x11\x12\x04time\n\x7fR}\n\x14bin_maxbins_20_delay\n\x18bin_maxbins_20_delay_end\n\x17bin_maxbins_20_distance\n\x1bbin_maxbins_20_distance_end\n\x05delay\n\x08distance\n\x04timeB\x12\n\x10America/New_York\x12\x00\x1a\x04\x08\x07\x10\x01\x1a\x04\x08\x04\x10\x01\x1a\x04\x08\x05\x10\x01 \xc6\xfb\x8f\x85\xc7\xe9\xea\xe0 (\xf9\x8b\xa8\x93\xff\xb2\xf3\xb25\n\xd3\x03\n\xb6\x03\n\n\n\x06data_5\x10\x012\x93\x03\n\x06data_0\x12\x88\x03\nF*D\n\x17bin_maxbins_20_distance\n\x1bbin_maxbins_20_distance_end\x12\x00\x1a\x07__count"\x01\x00\n\xfa\x01\n\xf7\x01\n\xf4\x01"\xeb\x01\nl:d\n\x07isValid\x12YRQ\n\x0f\n\x07\n\x05datumZ\x04\x08\x08\x10\r\x12<\x124\n\x19"bin_maxbins_20_distance"\x12\x17bin_maxbins_20_distanceZ\x04\x08\x0e\x10\'\x18\x01Z\x04\x08\r\x10(Z\x04\x08\x07\x10)\x10\x01\x1ay:q\n\x08isFinite\x12e*]\x10\x01\x1aYRQ\n\x0f\n\x07\n\x05datumZ\x04\x087\x10<\x12<\x124\n\x19"bin_maxbins_20_distance"\x12\x17bin_maxbins_20_distanceZ\x04\x08=\x10V\x18\x01Z\x04\x08<\x10WZ\x04\x086\x10WZ\x04\x085\x10XZ\x04\x08*\x10X\nAR?\n\x07__count\n\x17bin_maxbins_20_distance\n\x1bbin_maxbins_20_distance_endB\x12\n\x10America/New_York\x12\x02\x08\x03 \xe1\xe7\x8b\x8c\x9e\xb4\xb3\xf7\xda\x01(\x8b\xb2\xc5\xea\x93\xfb\xab\xeb\xfb\x01\n\xba\x03\n\x9e\x03\n\n\n\x06data_4\x10\x012\xfb\x02\n\x06data_0\x12\xf0\x02\n@*>\n\x14bin_maxbins_20_delay\n\x18bin_maxbins_20_delay_end\x12\x00\x1a\x07__count"\x01\x00\n\xee\x01\n\xeb\x01\n\xe8\x01"\xdf\x01\nf:^\n\x07isValid\x12SRK\n\x0f\n\x07\n\x05datumZ\x04\x08\x08\x10\r\x126\x12.\n\x16"bin_maxbins_20_delay"\x12\x14bin_maxbins_20_delayZ\x04\x08\x0e\x10$\x18\x01Z\x04\x08\r\x10%Z\x04\x08\x07\x10&\x10\x01\x1as:k\n\x08isFinite\x12_*W\x10\x01\x1aSRK\n\x0f\n\x07\n\x05datumZ\x04\x084\x109\x126\x12.\n\x16"bin_maxbins_20_delay"\x12\x14bin_maxbins_20_delayZ\x04\x08:\x10P\x18\x01Z\x04\x089\x10QZ\x04\x083\x10QZ\x04\x082\x10RZ\x04\x08\'\x10R\n;R9\n\x07__count\n\x14bin_maxbins_20_delay\n\x18bin_maxbins_20_delay_endB\x12\n\x10America/New_York\x12\x02\x08\x03 \x92\x80\xc2\x88\xe4\xbf\xa0\xf9\x83\x01(\x81\x98\xee\xce\xde\xc7\x91\xf64\n\x85\x03\n\xe1\x02\n\x11\n\rparam_1_store\x10\x01\x1a\xcb\x02\x12\xc8\x02\xff\xff\xff\xff\xb8\x00\x00\x00\x10\x00\x00\x00\x00\x00\n\x00\x0c\x00\n\x00\t\x00\x04\x00\n\x00\x00\x00\x10\x00\x00\x00\x00\x01\x04\x00\x08\x00\x08\x00\x00\x00\x04\x00\x08\x00\x00\x00\x04\x00\x00\x00\x01\x00\x00\x00\x14\x00\x00\x00\x10\x00\x16\x00\x10\x00\x0e\x00\x0f\x00\x04\x00\x00\x00\x08\x00\x10\x00\x00\x00\x18\x00\x00\x00\x1c\x00\x00\x00\x00\x00\x01\x02\x18\x00\x00\x00\x00\x00\x06\x00\x08\x00\x04\x00\x06\x00\x00\x00@\x00\x00\x00\x00\x00\x00\x00\t\x00\x00\x00_vf_order\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xffx\x00\x00\x00\x10\x00\x00\x00\x00\x00\n\x00\x0e\x00\x0c\x00\x0b\x00\x04\x00\n\x00\x00\x00\x14\x00\x00\x00\x00\x00\x00\x03\x04\x00\n\x00\x0c\x00\x00\x00\x08\x00\x04\x00\n\x00\x00\x00\x1c\x00\x00\x00\x04\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\x00\x1a\x04\x08\x07\x10\x01\x1a\x04\x08\n\x10\x01 \x80\xf6\xe3\xa5\xd3\xe5\xf5\xec\xb7\x01(\x9c\xe2\xed\x88\xb3\xfc\x85\xc1\x10\n\x84\x03\n\xd8\x02\n\n\n\x06data_1\x10\x012\xb5\x02\n\x06data_0\x12\xaa\x02\n\xbd\x01\n\xba\x01\n\xb7\x01"\xae\x01\nV*P\x08\x02\x10\x01\x1aJ:B\n\x06length\x128:0\n\x04data\x12(\x12 \n\x0f"param_1_store"\x12\rparam_1_storeZ\x04\x08\r\x10\x1cZ\x04\x08\x0c\x10\x1dZ\x04\x08\x07\x10\x1eZ\x02\x10\x1e\x1aT:L\n\x0fvlSelectionTest\x12(\x12 \n\x0f"param_1_store"\x12\rparam_1_storeZ\x04\x082\x10A\x12\x0f\n\x07\n\x05datumZ\x04\x08C\x10HZ\x04\x081\x10IZ\x04\x08\x1f\x10I\nhRf\n\x14bin_maxbins_20_delay\n\x18bin_maxbins_20_delay_end\n\x17bin_maxbins_20_distance\n\x1bbin_maxbins_20_distance_endB\x12\n\x10America/New_York\x12\x02\x08\x03\x12\x02\x08\x06\x1a\x04\x08\x08\x10\x01\x1a\x04\x08\t\x10\x01 \xef\xdd\x91\xc4\xc7\xe7\xf1\xda\x97\x01(\xf1\x99\x9e\xc9\x8e\xd8\x8b\xcb#\n\xba\x03\n\x9e\x03\n\n\n\x06data_2\x10\x012\xfb\x02\n\x06data_1\x12\xf0\x02\n@*>\n\x14bin_maxbins_20_delay\n\x18bin_maxbins_20_delay_end\x12\x00\x1a\x07__count"\x01\x00\n\xee\x01\n\xeb\x01\n\xe8\x01"\xdf\x01\nf:^\n\x07isValid\x12SRK\n\x0f\n\x07\n\x05datumZ\x04\x08\x08\x10\r\x126\x12.\n\x16"bin_maxbins_20_delay"\x12\x14bin_maxbins_20_delayZ\x04\x08\x0e\x10$\x18\x01Z\x04\x08\r\x10%Z\x04\x08\x07\x10&\x10\x01\x1as:k\n\x08isFinite\x12_*W\x10\x01\x1aSRK\n\x0f\n\x07\n\x05datumZ\x04\x084\x109\x126\x12.\n\x16"bin_maxbins_20_delay"\x12\x14bin_maxbins_20_delayZ\x04\x08:\x10P\x18\x01Z\x04\x089\x10QZ\x04\x083\x10QZ\x04\x082\x10RZ\x04\x08\'\x10R\n;R9\n\x07__count\n\x14bin_maxbins_20_delay\n\x18bin_maxbins_20_delay_endB\x12\n\x10America/New_York\x12\x02\x08\x07 \xa0\x82\xb3\xf1\xab\x8e\x82\xda\xcb\x01(\x90\xc2\x83\xbd\xf8\xd6\xaa\xb2\x17\n\xd3\x03\n\xb6\x03\n\n\n\x06data_3\x10\x012\x93\x03\n\x06data_1\x12\x88\x03\nF*D\n\x17bin_maxbins_20_distance\n\x1bbin_maxbins_20_distance_end\x12\x00\x1a\x07__count"\x01\x00\n\xfa\x01\n\xf7\x01\n\xf4\x01"\xeb\x01\nl:d\n\x07isValid\x12YRQ\n\x0f\n\x07\n\x05datumZ\x04\x08\x08\x10\r\x12<\x124\n\x19"bin_maxbins_20_distance"\x12\x17bin_maxbins_20_distanceZ\x04\x08\x0e\x10\'\x18\x01Z\x04\x08\r\x10(Z\x04\x08\x07\x10)\x10\x01\x1ay:q\n\x08isFinite\x12e*]\x10\x01\x1aYRQ\n\x0f\n\x07\n\x05datumZ\x04\x087\x10<\x12<\x124\n\x19"bin_maxbins_20_distance"\x12\x17bin_maxbins_20_distanceZ\x04\x08=\x10V\x18\x01Z\x04\x08<\x10WZ\x04\x086\x10WZ\x04\x085\x10XZ\x04\x08*\x10X\nAR?\n\x07__count\n\x17bin_maxbins_20_distance\n\x1bbin_maxbins_20_distance_endB\x12\n\x10America/New_York\x12\x02\x08\x07 \xa5\xc6\xbc\xb8\x9c\xd4\xaa\xfb\x8d\x01(\xcc\xab\xb2\x94\xed\xe4\xea\x87\xb6\x01\n\xf6\x04\n\xd6\x04\n\n\n\x06data_7\x10\x012\xb3\x04\n\x06data_6\x12\xa8\x04\n\xbd\x01\n\xba\x01\n\xb7\x01"\xae\x01\nV*P\x08\x02\x10\x01\x1aJ:B\n\x06length\x128:0\n\x04data\x12(\x12 \n\x0f"param_1_store"\x12\rparam_1_storeZ\x04\x08\r\x10\x1cZ\x04\x08\x0c\x10\x1dZ\x04\x08\x07\x10\x1eZ\x02\x10\x1e\x1aT:L\n\x0fvlSelectionTest\x12(\x12 \n\x0f"param_1_store"\x12\rparam_1_storeZ\x04\x082\x10A\x12\x0f\n\x07\n\x05datumZ\x04\x08C\x10HZ\x04\x081\x10IZ\x04\x08\x1f\x10I\n>*<\n\x13bin_maxbins_20_time\n\x17bin_maxbins_20_time_end\x12\x00\x1a\x07__count"\x01\x00\n\xea\x01\n\xe7\x01\n\xe4\x01"\xdb\x01\nd:\\\n\x07isValid\x12QRI\n\x0f\n\x07\n\x05datumZ\x04\x08\x08\x10\r\x124\x12,\n\x15"bin_maxbins_20_time"\x12\x13bin_maxbins_20_timeZ\x04\x08\x0e\x10#\x18\x01Z\x04\x08\r\x10$Z\x04\x08\x07\x10%\x10\x01\x1aq:i\n\x08isFinite\x12]*U\x10\x01\x1aQRI\n\x0f\n\x07\n\x05datumZ\x04\x083\x108\x124\x12,\n\x15"bin_maxbins_20_time"\x12\x13bin_maxbins_20_timeZ\x04\x089\x10N\x18\x01Z\x04\x088\x10OZ\x04\x082\x10OZ\x04\x081\x10PZ\x04\x08&\x10P\n9R7\n\x07__count\n\x13bin_maxbins_20_time\n\x17bin_maxbins_20_time_endB\x12\n\x10America/New_York\x12\x02\x08\x01\x12\x02\x08\x06 \xba\xb1\xed\x88\xff\xc8\xff\xe7$(\xb9\xea\x92\xcd\xe2\xda\xe3\xed\xf1\x01\x12\x02\x08\n\x12\x02\x08\x02\x12\x02\x08\x04\x12\x02\x08\x05\x12\x04\x08\x03\x10\x02\x12\x04\x08\x01\x10\x00\x12\x04\x08\x03\x10\x00\x12\x02\x08\t\x12\x02\x08\x08', 12, 16, 'code point not in range(0x110000)')
Traceback (most recent call last):
File "/Users/jonmmease/miniconda3/envs/try_solara/lib/python3.10/site-packages/bokeh/server/protocol_handler.py", line 97, in handle
work = await handler(message, connection)
File "/Users/jonmmease/miniconda3/envs/try_solara/lib/python3.10/site-packages/bokeh/server/session.py", line 94, in _needs_document_lock_wrapper
result = func(self, *args, **kwargs)
File "/Users/jonmmease/miniconda3/envs/try_solara/lib/python3.10/site-packages/bokeh/server/session.py", line 288, in _handle_patch
message.apply_to_document(self.document, self)
File "/Users/jonmmease/miniconda3/envs/try_solara/lib/python3.10/site-packages/bokeh/protocol/messages/patch_doc.py", line 104, in apply_to_document
invoke_with_curdoc(doc, lambda: doc.apply_json_patch(self.payload, setter=setter))
File "/Users/jonmmease/miniconda3/envs/try_solara/lib/python3.10/site-packages/bokeh/document/callbacks.py", line 443, in invoke_with_curdoc
return f()
File "/Users/jonmmease/miniconda3/envs/try_solara/lib/python3.10/site-packages/bokeh/protocol/messages/patch_doc.py", line 104, in <lambda>
invoke_with_curdoc(doc, lambda: doc.apply_json_patch(self.payload, setter=setter))
File "/Users/jonmmease/miniconda3/envs/try_solara/lib/python3.10/site-packages/bokeh/document/document.py", line 376, in apply_json_patch
DocumentPatchedEvent.handle_event(self, event, setter)
File "/Users/jonmmease/miniconda3/envs/try_solara/lib/python3.10/site-packages/bokeh/document/events.py", line 246, in handle_event
event_cls._handle_event(doc, event)
File "/Users/jonmmease/miniconda3/envs/try_solara/lib/python3.10/site-packages/bokeh/document/events.py", line 281, in _handle_event
cb(event.msg_data)
File "/Users/jonmmease/miniconda3/envs/try_solara/lib/python3.10/site-packages/ipywidgets_bokeh/kernel.py", line 81, in receive
msg = json.loads(data)
File "/Users/jonmmease/miniconda3/envs/try_solara/lib/python3.10/json/__init__.py", line 341, in loads
s = s.decode(detect_encoding(s), 'surrogatepass')
File "/Users/jonmmease/miniconda3/envs/try_solara/lib/python3.10/encodings/utf_32_be.py", line 11, in decode
return codecs.utf_32_be_decode(input, errors, True)
UnicodeDecodeError: 'utf-32-be' codec can't decode bytes in position 12-15: code point not in range(0x110000)
It looks like the issue is related to the _request_msg
being provided as binary.
Here's the definitions of this prop on the Python side of the widget (See https://github.com/hex-inc/vegafusion/blob/main/python/vegafusion-jupyter/vegafusion_jupyter/widget.py#L31-L32)
from traitlets import CBytes
class VegaFusionWidget(DOMWidget):
...
# Message transport properties
_request_msg = CBytes(allow_none=True, read_only=True).tag(sync=True)
_response_msg = CBytes(allow_none=True).tag(sync=True)
My guess is that the CBytes
traitlet type is not supported by ipywidgets_bokeh
1.4.0.
Thanks for the update @jonmmease! I'd love to support VegaFusion properly and we'll probably do two things to make that happen:
- A ground-up rewrite of ipywidgets_bokeh
- A panel-vegafusion extension package
I'll reach out when we're ready to start on that.
Just wanted to pass along an update. I've reworked the VegaFusion architecture a bit to make it possible to integrate VegaFusion into Altair's regular JupyterChart. See vega/altair#3281.
This doesn't require binary serialization and already works well with Panel. I'm going to deprecate VegaFusionWidget
in the future and direct people to JupyterChart
. If you wanted, it should be possible to do something similar with the Vega pane, where VegaFusion is used automatically when it's enabled in Altair.