0

I want to run a bokeh app on heroku. As an example, I can give the following code I took from this website.

import numpy as np
from numpy import pi

from bokeh.client import push_session
from bokeh.driving import cosine
from bokeh.plotting import figure, curdoc

x = np.linspace(0, 4*pi, 80)
y = np.sin(x)

p = figure()
r1 = p.line([0, 4*pi], [-1, 1], color="firebrick")
r2 = p.line(x, y, color="navy", line_width=4)

# open a session to keep our local document in sync with server
session = push_session(curdoc())

@cosine(w=0.03)
def update(step):
    # updating a single column of the the *same length* is OK
    r2.data_source.data["y"] = y * step
    r2.glyph.line_alpha = 1 - 0.8 * abs(step)

curdoc().add_periodic_callback(update, 50)

session.show(p) # open the document in a browser

session.loop_until_closed() # run forever

So, to run this on heroku, I've found that, I need to do the steps explained in this answer.

However, it is not stated here or somewhere else what should I add to the requirements.txt file when I use bokeh. Is there anyone who can help me about this and other things that I need to do for running a bokeh app on heroku?

Community
  • 1
  • 1
zwlayer
  • 1,752
  • 1
  • 18
  • 41
  • The easiest way to create a `requirements.txt` file, assuming you already have the code running locally with everything installed, is `pip freeze > requirements.txt`. Note that if you don't use a per-project virtualenv this will probably contain a bunch of stuff you actually don't need. – jonrsharpe Mar 27 '17 at 21:05
  • Alternatively if you are using `conda` you can run `conda list --export` but the very short list of requirements is also given below. – bigreddot Apr 18 '17 at 01:42

1 Answers1

0

The list of runtime requirements for Bokeh is veryy short. They are given in the project setup.py:

REQUIRES = [
    'six >=1.5.2',
    'requests >=1.2.3',
    'PyYAML >=3.10',
    'python-dateutil >=2.1',
    'Jinja2 >=2.7',
    'numpy >=1.7.1',
    'tornado >=4.3',
]

# handle the compat difference for futures 
if sys.version_info[:2] == (2, 7):
    REQUIRES.append('futures >=3.0.3')

There are some optional dependencies. bokeh.charts depends on Pandas, and using custom extensions depends on having NodeJS installed (via conda or some other means)

bigreddot
  • 33,642
  • 5
  • 69
  • 122