Installation

This section provides complete details about Bokeh’s required and optional dependencies as well as information about how to install Bokeh in different situations. To get up and running as fast as possible, see the Installation section of the Quickstart.

Supported Platforms

Bokeh is officially supported (and continuously tested) on CPython versions 2.7 and 3.5+ only. Other Python versions or implementations may function, possibly limited capacity, but no guarantees or support is provided.

Required Dependencies

For basic usage, have the following libraries installed:

Jinja2 >=2.7
numpy >=1.7.1
packaging >=16.8
pillow >=4.0
python-dateutil >=2.1
PyYAML >=3.10
six >=1.5.2
tornado >=4.3

To use the Bokeh server with Python 2.7, you also must install the Futures package.

Optional Dependencies

In addition to the required dependencies above, some additional packages are necessary for certain optional features:

NodeJS

Necessary for Extending Bokeh or for defining CustomJS implementations in CoffeeScript or TypeScript.

Pandas

Necessary for the hexbin function. Additionally, some usage is simplified by using Pandas e.g. Pandas DataFrames will be converted automatically to Bokeh data sources by glyph functions.

psutil

Necessary to enable detailed memory logging in the Bokeh server.

NetworkX

Necessary to use the from_networkx function to generate Bokeh graph renderers directly from NetworkX data.

Selenium, PhantomJS

Necessary for Exporting Plots to PNG and SVG images.

Sphinx

Necessary to make use of the bokeh.sphinxext Sphinx extension for including Bokeh plots in Sphinx documentation.

Standard Releases

These Bokeh dependencies are best obtained via the Anaconda Python Distribution, which was designed to include robust versions of popular libraries for the Python scientific and data analysis stacks.

If you are already an Anaconda user, you can simply run the command:

conda install bokeh

This will install the most recent published Bokeh release from the Anaconda, Inc. package repository, along with all dependencies.

Alternatively, it is possible to install from PyPI using pip:

pip install bokeh

Sample Data

Some of the Bokeh examples rely on sample data that is not included in the Bokeh GitHub repository or released packages, due to their size. Once Bokeh is installed, the sample data can be obtained by executing the following command at a Bash or Windows prompt:

bokeh sampledata

Alternatively, the following statements can be executed in a Python interpreter:

>>> import bokeh.sampledata
>>> bokeh.sampledata.download()

Finally, the location that the sample data is stored can be configured. By default, data is downloaded and stored to a directory $HOME/.bokeh/data. (The directory is created if it does not already exist.) Bokeh looks for a YAML configuration file at $HOME/.bokeh/config. The YAML key sampledata_dir can be set to the absolute path of a directory where the data should be stored. For instance adding the following line to the config file:

sampledata_dir: /tmp/bokeh_data

will cause the sample data to be stored in /tmp/bokeh_data.

Verifying Installation

The first check you can make is to make sure you can import bokeh and verify bokeh.__version__ from a running python interpreter. If you execute both of those lines in a python interpreter, the result should look something like this:

../_images/bokeh_import.png

The next check you can make is to produce a very simple plot. Execute the following few lines of python code, either by copying them into a script and executing the script, or by running the lines by hand in a python interpreter:

from bokeh.plotting import figure, output_file, show
output_file("test.html")
p = figure()
p.line([1, 2, 3, 4, 5], [6, 7, 2, 4, 5], line_width=2)
show(p)

This should save a test.html file locally, and open a browser tab to view the file. The result should look like this:

../_images/bokeh_simple_test.png

Advanced Cases

In addition to the standard installation methods above, Bokeh can also be installed in some specialized ways for advanced usage or development.

Source Code

Installing Bokeh from source requires rebuilding the BokehJS library from its TypeScript sources. Some additional toolchain support is required. Please consult the Getting Set Up section of the Developer Guide for detailed instructions.

BokehJS

If you would like to use BokehJS as a standalone JavaScript library, released versions of BokehJS are available for download from CDN at pydata.org, under the following naming scheme:

# Javascript files
http://cdn.pydata.org/bokeh/release/bokeh-x.y.z.min.js
http://cdn.pydata.org/bokeh/release/bokeh-widgets-x.y.z.min.js
http://cdn.pydata.org/bokeh/release/bokeh-tables-x.y.z.min.js
http://cdn.pydata.org/bokeh/release/bokeh-api-x.y.z.min.js

The "-widgets" files are only necessary if you are using any of the widgets built into Bokeh in bokeh.models.widgets in your documents. Similarly, the "-tables" files are only necessary if you are using Bokeh data tables in your document. The "bokeh-api" files are required to use the BokehJS API, and must be loaded after the core BokehJS library.

As a concrete example, the links for version 1.0.0 are: