Bokeh plotting changes between 2.0.2 and 2.1.x

I have a bokeh server application with a fairly complex layout, which works properly in bokeh 2.0.2.

I have reviewed the release notes for bokeh 2.1.0 and 2.1.1 to try to understand if there are any significant changes to how model layouts as grids, columns, rows, etc. have changed but haven’t found anything that stands out. Are there any intentional changes to highlight in this area? (It will take me a while to pare down my code to create a minimal reproducible example, which I will pursue in parallel.)

2.0.2: The following screen capture is an excerpt of the UI area that is relevant to this topic, generated with bokeh 2.0.2. This shows a working setup.

2.1.0: I recently upgraded bokeh to 2.1.0, and the previously working code fails, with the last line of the stack trace as follows. The parts of the UI that precede the accuracy plots still render and work, but the overall and per-class accuracy regions do not render.

/opt/anaconda3/envs/rrvv/lib/python3.7/site-packages/bokeh/core/property/", line 463, in from_json
    raise DeserializationError("%s expected %s, got %s of type %s" % (self, expected, json, type(json).__name__)) Enum('left', 'right', 'center') expected str, got {'value': 'center'} of type dict

2.1.1: Upon upgrading to 2.1.1, the deserialization errors are resolved. However, the overall and per-class accuracy parts of my UI still no longer render. There are no reported errors in the server console. However, the browser’s console does show errors. See following screen capture.

Nothing intentional, so a GitHub issue would be appropriate. But not we would absolutely need some kind of complete, minimal reproducer to be able to investigate.


A minimal reproducible example is at the end of this post.

It turns out the problem is caused by behaviors implemented in elements of my complex layouts and not the layouts explicitly.

In particular, there are transforms that seem to work when used in bokeh 2.0.2, but break in 2.1.0. The problems persist in bokeh 2.1.1.

The expected output as shown in bokeh 2.0.2 is shown in the following screen capture.

In bokeh 2.1.0 (and 2.1.1), the browser page is blank. The Javascript console shows the following error.


#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np

from bokeh.plotting import figure, show
from bokeh.transform import transform

from bokeh.models import ColumnDataSource
from bokeh.models import LinearInterpolator

# Referencce curve
x = np.linspace(0.0,1.0,1001)
y = np.tanh(np.pi*x)

Sref = ColumnDataSource(data=dict(x=x, y=y))

# Operating point constrained to reference curve
op = 301
Ssel = ColumnDataSource(data=dict(x=[x[op]], y=y[[op]]))

_li_x = LinearInterpolator(x='x', y='x', data=Sref, clip=False)
_js_x = transform('x', _li_x)
_li_y = LinearInterpolator(x='x', y='y', data=Sref, clip=False)
_js_y = transform('x', _li_y)

p = figure(width=400, height=300)
p.line(x='x', y='y', source=Sref)
p.inverted_triangle(x=_js_x, y=_js_y, source=Ssel, size=15, line_color='#000000', fill_color='#000000')


bokeh github issue 10320 opened.

1 Like

I looks like @mateusz already opened a WIP PR so :crossed_fingers: should be fixed in time or 2.2

Great! Love how responsive and efficient the bokeh team is. Thank you.