4

Bokeh used to work fine for me. It just stopped working this week. I get the same behavior on FireFox and Chrome on my mac. Here's an example of the problem. This is my jupyter code:

import pandas as pd
import datetime
import matplotlib.pyplot as plt
import itertools as itt
import bokeh.plotting as bk
bk.output_notebook()

xs = [0,1,2,3,4,5]
ys = [x**2 for x in xs]

p = bk.figure()

p.line(xs, ys, line_width=2)
p.circle(xs,ys)
bk.show(p)

The only output is "Loading BokehJS ..."

3
  • Have you tried to upgrade bokeh through pip recently? Also what distro of python are you working with? If you edit you answer to include your system specs it will be easier to diagnose the problem. Commented Jan 25, 2017 at 1:00
  • I just tried this code (minus the unused imports) with Bokeh 0.12.4 on all those browsers on OSX, and it worked perfectly fine. It is literally impossible to help with platform specific problems like this, in any way, without complete information: what OS version are you on? what version of bokeh are you using? what versions of the browsers? What version of jupyter notebook? Commented Jan 25, 2017 at 2:17
  • Thanks for your help. I think I found the problem. For some reason, Bokeh won't work when on my VPN. When I'm not on the VPN, it works just fine. I am guessing that Bokeh requires connection to somewhere, perhaps pydata.org? I also noticed today that pydata.org doesn't work when I'm on the VPN. Are there ways to run Bokeh in a more local mode, or does it always need a connection to the internet? Commented Jan 25, 2017 at 4:08

2 Answers 2

9

Bokeh plots rely on a JavaScript library, BokehJS. By default (and by popular demand) BokehJS is loaded remotely from a CDN (specifically, from https://cdn.bokeh.org). Accordingly, viewing a Bokeh plot that is configured to use CDN resource requires an active and working network connection.

But it's possible to use "inline" resources, which means the BokehJS library is included directly in the HTML output that Bokeh (the python library) generates. The easiest way to to do this is to set the environment variable:

BOKEH_RESOURCES=inline

before you run your script or the notebook server. There are other ways to specify resources, though, too. For more details see the documentation.

Sign up to request clarification or add additional context in comments.

Comments

7

You can follow this, worked for me.

from bokeh.resources import INLINE
import bokeh.io

bokeh.io.output_notebook(INLINE)

Comments

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.