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.
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.
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.
In addition to the required dependencies above, some additional packages are necessary for certain optional features:
Necessary for Extending Bokeh or for defining
CustomJSimplementations in CoffeeScript or TypeScript.
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.
Necessary to enable detailed memory logging in the Bokeh server.
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.
Necessary to make use of the
bokeh.sphinxextSphinx extension for including Bokeh plots in Sphinx documentation.
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 install bokeh
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:
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
(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
will cause the sample data to be stored in
The first check you can make is to make sure you can
import bokeh and
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:
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:
In addition to the standard installation methods above, Bokeh can also be installed in some specialized ways for advanced usage or development.
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.
An easier way to obtain the most recent Bokeh updates without having to worry about building Bokeh yourself is to install a developer build. Developer builds are not published on any particular schedule but often come out a few times a month or more.
These builds are made available on the “bokeh” channel of anaconda.org. If you are using Anaconda, you can install with conda by issuing the command from a Bash or Windows command prompt:
conda install -c bokeh/channel/dev bokeh
Alternatively you can install with pip from a Bash or Windows command prompt:
pip install --pre -i https://pypi.anaconda.org/bokeh/channel/dev/simple bokeh --extra-index-url https://pypi.python.org/simple/
We attempt to make sure the developer builds are relatively stable, however please be aware they they are not tested as rigorously as standard releases. Any problems or issues reported on the GitHub issue tracker are appreciated.
BokehJS resources for developer builds are not guaranteed to be permanently available. You should never use any artifacts made by a developer build “in production”.
"-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