question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bokeh serve does not work with module names with spaces

See original GitHub issue

I have a file called “bokeh app.py” saved in Documents folder as follows:

import pandas as pd
import numpy as np
from bokeh.plotting import figure
from bokeh.io import output_file, show, curdoc
from bokeh.plotting import ColumnDataSource
from bokeh.models import HoverTool, Slider
from bokeh.models import CategoricalColorMapper
from bokeh.layouts import row, column, gridplot, widgetbox
from bokeh.models.widgets import Panel, Tabs

a = 0.3; b = 10.04
x = np.arange(a, b, (b-a)/300)
a = -0.1; b = 0.1
y = np.arange(a, b, (b-a)/300)

source = ColumnDataSource(data={'x':x, 'y':y})

plot = figure()
plot.line('x', 'y', source=source)

slider = Slider(title='slider', start=0, end=10, step=0.1, value=1)

def callback(attr, old, new):
    scale = slider.value
    new_y = np.sin(scale/x)
    source.data = {'x': x, 'y': new_y}

# Attach the callback to the 'value' property of slider
slider.on_change('value', callback)  

layout = column(widgetbox(slider), plot)
curdoc().add_root(layout)

When I run `bokeh serve “documents\bokeh app.py” in anaconda prompt, I got these messages:

(venv) D:\Users\jng>bokeh serve "documents\bokeh app.py"
2020-03-10 11:28:11,906 Starting Bokeh server version 2.0.0 (running on Tornado 5.1.1)
2020-03-10 11:28:12,004 User authentication hooks NOT provided (default user enabled)
2020-03-10 11:28:12,101 Bokeh app running at: http://localhost:5006/bokeh app
2020-03-10 11:28:12,103 Starting Bokeh server with process id: 13852

But no visual displayed anywhere. I then entered this http://localhost:5006/bokeh app in chrome browser, it said “404: Not Found”, and some additional messages appeared in the anaconda prompt

(venv) D:\Users\jng09>bokeh serve "documents\bokeh app.py"
2020-03-10 11:28:11,906 Starting Bokeh server version 2.0.0 (running on Tornado 5.1.1)
2020-03-10 11:28:12,004 User authentication hooks NOT provided (default user enabled)
2020-03-10 11:28:12,101 Bokeh app running at: http://localhost:5006/bokeh app
2020-03-10 11:28:12,103 Starting Bokeh server with process id: 13852
2020-03-10 12:41:21,539 404 GET /bokeh%20app (::1) 1.00ms
2020-03-10 12:41:21,828 404 GET /favicon.ico (::1) 1.00ms
2020-03-10 12:51:24,548 404 GET /bokeh%20app (::1) 1.00ms

My questions are:

  • Is this a bug?
  • How to fix it?

Thanks

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
bryevdvcommented, Mar 10, 2020

@jaseuts --show is a useful convenience for anyone running things locally on their own systems, but if you are deploying a Bokeh server in a production setting, then the instance running the bokeh serve command is most likely a remote computer in some data center, that no one has physical access to (it may not even have a display attached).

1reaction
bryevdvcommented, Mar 10, 2020

@jaseuts perhaps you should also try running with the --show option. That will raise a browser to the correct location for you, in case going to the right location is the issue you are having

bokeh serve --show bokehApp.py
Read more comments on GitHub >

github_iconTop Results From Across the Web

Running a Bokeh Server — Bokeh 2.2.2 Documentation
The purpose of the Bokeh server is to make it easy for Python users to create interactive web applications that can connect front-end...
Read more >
Entry point for a bokeh server - python
I think nothing is stopping you from using several charts in one document (rendered in one application, I guess?) like in the heatmap...
Read more >
bokeh Changelog - pyup.io
- 5629 [component: server] [starter] Bokeh server reports "none" port when there is a port conflict. - 5644 Hasprops.apply_theme does not work on...
Read more >
Interactive Data Visualization with Bokeh - Trenton McKinney
Bokeh is an interactive data visualization library for Python, ... female_literacy) # Call the output_file() function and specify the name of the file ......
Read more >
How to deploy a Bokeh app on Heroku | by Jo Dorning
It should have the following structure, where myapp is the custom app name. web: bokeh serve — port=$PORT — allow-websocket-origin=myapp.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found