Bokeh - Environment Setup



Bokeh can be installed on CPython versions 3.10+ only both with Standard distribution and Anaconda distribution. Current version of Bokeh at the time of writing this tutorial is ver. 3.8.1.

Bokeh can be installed using Pythons built-in Package manager PIP as shown below −

pip3 install bokeh

If you are using Anaconda distribution, use conda package manager as follows −

conda install bokeh

In addition to the above dependencies, you may require additional packages such as pandas, psutil, etc., for specific purposes.

Install Bokeh

Bokeh package is not a part of Python's standard library, hence it must be installed. Before installing the latest version, let us create a virtual environment, as per Python's recommended method.

A virtual environment allows us to create an isolated working copy of python for a specific project without affecting the outside setup.

We shall use venv module in Python's standard library to create virtual environment. PIP is included by default in Python version 3.4 or later.

Use the following command to create virtual environment in Windows

D:\bokeh>py -m venv myenv

On Ubuntu Linux, update the APT repo and install venv if required before creating virtual environment

mvl@GNVBGL3:~ $ sudo apt update && sudo apt upgrade -y
mvl@GNVBGL3:~ $ sudo apt install python3-venv

Then use the following command to create a virtual environment

mvl@GNVBGL3:~ $ sudo python3 -m venv myenv

You need to activate the virtual environment. On Windows use the command

D:\bokeh>cd myenv
D:\bokeh\myenv>scripts\activate
(myenv) D:\bokeh\myenv>

On Ubuntu Linux, use following command to activate the virtual environment

mvl@GNVBGL3:~$ cd myenv
mvl@GNVBGL3:~/myenv$ source bin/activate
(myenv) mvl@GNVBGL3:~/myenv$

Name of the virtual environment appears in the parenthesis. Now that it is activated, we can now install bokeh in it.

(myenv) D:\bokeh\myenv> pip3 install bokeh
     Collecting bokeh
  Obtaining dependency information for bokeh from https://files.pythonhosted.org/packages/5d/e7/b18bee0772d49c0f78d57f15a68e85257abf7224d9b910706abe8bd1dc0f/bokeh-3.8.1-py3-none-any.whl.metadata
  Downloading bokeh-3.8.1-py3-none-any.whl.metadata (10 kB)
  ...
  Installing collected packages: pytz, xyzservices, tzdata, tornado, six, PyYAML, pillow, packaging, numpy, narwhals, MarkupSafe, python-dateutil, Jinja2, contourpy, pandas, bokeh
Successfully installed Jinja2-3.1.6 MarkupSafe-3.0.3 PyYAML-6.0.3 bokeh-3.8.1 contourpy-1.3.3 narwhals-2.14.0 numpy-2.3.5 packaging-25.0 pandas-2.3.3 pillow-12.0.0 python-dateutil-2.9.0.post0 pytz-2025.2 six-1.17.0 tornado-6.5.4 tzdata-2025.3 xyzservices-2025.11.0

Verify Installation

To verify if Bokeh has been successfully installed, import bokeh package in Python terminal and check its version −

(myenv) D:\bokeh\myenv>py
Python 3.12.1 (tags/v3.12.1:2305ca5, Dec  7 2023, 22:03:25) [MSC v.1937 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import bokeh
>>> bokeh.__version__
'3.8.1'
>>>
Advertisements