3

I have installed bokeh and downloaded myapp.py from the official page (http://docs.bokeh.org/en/latest/docs/user_guide/server.html) which looks like this.

# myapp.py

from random import random

from bokeh.layouts import column
from bokeh.models import Button
from bokeh.palettes import RdYlBu3
from bokeh.plotting import figure, curdoc

# create a plot and style its properties
p = figure(x_range=(0, 100), y_range=(0, 100), toolbar_location=None)
p.border_fill_color = 'black'
p.background_fill_color = 'black'
p.outline_line_color = None
p.grid.grid_line_color = None

# add a text renderer to our plot (no data yet)
r = p.text(x=[], y=[], text=[], text_color=[], text_font_size="20pt",
           text_baseline="middle", text_align="center")

i = 0

ds = r.data_source

# create a callback that will add a number in a random location
def callback():
    global i

    # BEST PRACTICE --- update .data in one step with a new dict
    new_data = dict()
    new_data['x'] = ds.data['x'] + [random()*70 + 15]
    new_data['y'] = ds.data['y'] + [random()*70 + 15]
    new_data['text_color'] = ds.data['text_color'] + [RdYlBu3[i%3]]
    new_data['text'] = ds.data['text'] + [str(i)]
    ds.data = new_data

    i = i + 1

# add a button widget and configure with the call back
button = Button(label="Press Me")
button.on_click(callback)

# put the button and plot in a layout and add to the document
curdoc().add_root(column(button, p))

In the terminal, I then execute:

bokeh serve --show myapp.py

And I see:

2017-04-17 13:24:50,576 Starting Bokeh server version 0.12.5
2017-04-17 13:24:50,581 Starting Bokeh server on port 5006 with applications at paths ['/myapp']
2017-04-17 13:24:50,581 Starting Bokeh server with process id: 700

My browser (tried both Safari and Chrome) then pops open a new tab for http://localhost:5006/myapp but the page doesn't load. It's stuck at about 10% on the progress bar and never changes from "Waiting for localhost...". I have installed the dependencies listed on the bokeh website. What am I missing?

I am running OS X 10.12.4 by the way. I have also tried on a Windows machine and have the exact same problem. There is nothing showing in the console of my web browser, it's just constantly "waiting for 127.0.0.1". I see one "302 GET" request in my terminal if I close the browser and try to reopen the page but that's it.

4
  • Assuming the erroneously split line at the and was only a formatting error here (I have edited to fix) then the code above runs fine for me on OSX and Bokeh 0.12.5 Any messages in browser javascript console? Commented Apr 17, 2017 at 17:38
  • @bigreddot thanks for fixing. updated post with info. Commented Apr 18, 2017 at 7:41
  • On Windows 7 64bit with Bokeh 0.12.5 installed with Anaconda I've got exactly the same issue (chrome and firefox). I've tried downgrading to 0.12.0 and it still won't load. Commented Apr 18, 2017 at 13:56
  • @Archibald Good to know it's not an Anaconda thing. I wondering if I was missing some basic dependency to make it work. Commented Apr 18, 2017 at 17:44

1 Answer 1

13

I expect you all are hitting this recent issue:

Bokeh Server is incompatible with tornado=4.5

Tornado 4.5 (released a few days ago) made a change that caused the Bokeh server to no longer function properly. A fix for this is in master and will be in the next 0.12.6 release. But the fix is also available in the latest dev builds. Your immediate options are:

  • downgrade Tornado to <= 4.4.2, or
  • install the Bokeh >= 0.12.6
Sign up to request clarification or add additional context in comments.

1 Comment

Nailed it. I downgraded Tornado to 4.4.2 to stick with well-tested versions and it now works. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.