I am new to Bokeh, so my question may be trivial to answer. I’m spent some time in the tutorials and documentation, and I can’t find a solution, so here I am. I am using Python 2.7 with Bokeh 0.12.3 in Windows 10. I am trying to update a rather large block of data using figure.image(…), large being in the neighborhood of 15 or so rows by 800000 elements wide. I will need to update this image every 30s or so. I have cluged code together from a few examples that is a first step toward what I need that represents the issue I am having. The code to reproduce the error is shown below. When I run this code with ‘bokeh serve --show [filename.py]’, it opens a tab in Internet Explorer to view the output, but a plot never shows up and I get the following output in the command window:
2016-12-22 15:47:20,269 Starting Bokeh server version 0.12.3
2016-12-22 15:47:20,279 Starting Bokeh server on port 5006 with applications at paths [’/bokeh_stream’]
2016-12-22 15:47:20,282 Starting Bokeh server with process id: 6476
2016-12-22 15:47:21,973 200 GET /bokeh_stream (127.0.0.1) 656.00ms
2016-12-22 15:47:22,278 WebSocket connection opened
2016-12-22 15:47:22,279 ServerConnection created
2016-12-22 15:48:10,992 received invalid integer in pong ‘’
Traceback (most recent call last):
File “C:\Users\codsmit\AppData\Local\Continuum\Anaconda2\envs\xprong_gpu\lib\site-packages\bokeh\server\views\ws.py”, line 167, in on_pong
self.latest_pong = int(codecs.decode(data, ‘utf-8’))
ValueError: invalid literal for int() with base 10: ‘’
2016-12-22 15:49:04,286 received invalid integer in pong ‘’
Traceback (most recent call last):
File “C:\Users\codsmit\AppData\Local\Continuum\Anaconda2\envs\xprong_gpu\lib\site-packages\bokeh\server\views\ws.py”, line 167, in on_pong
self.latest_pong = int(codecs.decode(data, ‘utf-8’))
ValueError: invalid literal for int() with base 10: ‘’
Another ‘ValueError’ shows up periodically in the window. However, if I change the ‘width = 192000’ to ‘width = 192000 / 2’ in the code, the correct plot will show up in the web browser, but I get the following command window output. Note the Bokeh Protocol error:
2016-12-22 15:44:39,890 Starting Bokeh server version 0.12.3
2016-12-22 15:44:39,901 Starting Bokeh server on port 5006 with applications at paths [’/bokeh_stream’]
2016-12-22 15:44:39,904 Starting Bokeh server with process id: 17732
2016-12-22 15:44:41,137 200 GET /bokeh_stream (127.0.0.1) 331.00ms
2016-12-22 15:44:41,456 WebSocket connection opened
2016-12-22 15:44:41,457 ServerConnection created
2016-12-22 15:45:25,017 error handling message Message ‘PATCH-DOC’ (revision 1): KeyError(‘references’,)
2016-12-22 15:45:25,023 Bad header with no msgtype was: {}
2016-12-22 15:45:25,026 Bokeh Server protocol error: No ‘msgtype’ in header, closing connection
2016-12-22 15:45:25,029 Bad header with no msgtype was: {}
2016-12-22 15:45:25,032 Bokeh Server protocol error: No ‘msgtype’ in header, closing connection
2016-12-22 15:45:25,033 Bad header with no msgtype was: {}
2016-12-22 15:45:25,036 Bokeh Server protocol error: No ‘msgtype’ in header, closing connection
2016-12-22 15:45:25,039 WebSocket connection closed: code=None, reason=None
Code to reproduce the error:
from bokeh.layouts import column
from bokeh.plotting import figure, curdoc
import numpy as np
width = 192000
x = np.linspace(0, width, width4)
h = 4
y = np.linspace(0, h, h4)
xx, yy = np.meshgrid(x, y)
d = np.sin(xx)*np.cos(yy)
create a plot and style its properties
p = figure(x_range=(0, width), y_range=(0, h), toolbar_location=None)
p.border_fill_color = ‘black’
p.background_fill_color = ‘black’
p.outline_line_color = None
p.grid.grid_line_color = None
r = p.image(image=, x=0, y=0, dw=width, dh=h, palette=“RdYlGn11”)
ds = r.data_source
def callback():
new_data = dict()
new_data[‘image’] = [d]
ds.data = new_data
curdoc().add_next_tick_callback(callback)
curdoc().add_root(column(p))
Are there any ideas out there for why increasing the width of the data will crash the Bokeh server? This isn’t the data I need to show, but it is sized to represent the size of output I will need.
Thanks in advance,
Cody