Bokeh whiskers 2.2.0

Hi everyone,

Just a quick question: I haven’t used bokeh in some time and I just opened up an old project to find that my Whiskers do not appear on plots anymore. Has there been any changes in how they work since release v.2.1.1?

Thanks in advance!

The changelog doesn’t mention anything, so perhaps you have found a bug or an undocumented change.
Can you share a minimal reproducible example that works on 2.1.1 but doesn’t work on 2.2.0?

Okay so I’m actually a biologist so I do not know how to make the example minimal, but here is the data file and a reworked version of the code (I am also french so I had to translate the commentaries, I hope it is understandable).

Link to the datafile: https://drive.google.com/file/d/1NiYTbkoI66pXrsCCYIDm3uz5ugu2dFO9/view?usp=sharing

import math

import bokeh as bk
import pandas as pd

tmpdf = pd.read_csv('path/to/file.csv', sep=';')

df_replicate_mean = tmpdf.groupby(["condition_order", "condition", "time", "isotopologue"])['mean_enrichment'].mean()
df_replicate_std = tmpdf.groupby(["condition_order", "condition", "time", "isotopologue"])['mean_enrichment'].std()
mean_df = df_replicate_mean.to_frame()
std_df = df_replicate_std.to_frame()

#Here we put the means into a df and clean up a bit
mean_df_unstack = mean_df.unstack()
mean_df_unstack = mean_df_unstack.droplevel(level = 0)
mean_df_unstack.columns = mean_df_unstack.columns.droplevel(level = 0)
mean_df_unstack.columns = mean_df_unstack.columns.astype(str)
mean_df_unstack.index = ['{}_{}'.format(i, j) for i, j in mean_df_unstack.index] #We rebuild ID column

#Columns have the same values, so we just take the first
mean_series = mean_df_unstack.iloc[:, 0].copy()

#Here we put the Stds into a df and clean up a bit
std_df_unstack = std_df.unstack()
std_df_unstack = std_df_unstack.droplevel(level = 0)
std_df_unstack.columns = std_df_unstack.columns.droplevel(level = 0)
std_df_unstack.columns = std_df_unstack.columns.astype(str)
std_df_unstack.index = ['{}_{}'.format(i, j) for i, j in std_df_unstack.index]

#Columns have the same values, so we just take the first
std_series = std_df_unstack.iloc[:, 0].copy()

#We prepare tops and bottoms for the error bars
upper_series = mean_series.add(std_series, fill_value=0)
upper_list = upper_series.to_list()

lower_series = mean_series.sub(std_series, axis='index', fill_value=0)
lower_list = lower_series.to_list()

#We prepare data to be plotted
my_x_range = mean_series.index.tolist()
values = mean_series.to_list()
my_dict = dict(ID=my_x_range, tops=values)
source = bk.models.ColumnDataSource(dict(ID=my_x_range, tops=values))

print("base = {}".format(my_x_range))
print("upper = {}".format(upper_list))
print("lower = {}".format(lower_list))

whisker_dico = dict(base = my_x_range, upper = upper_list, lower = lower_list)
source_error = bk.models.ColumnDataSource(whisker_dico)

#Passons au plot
TOOLTIPS = [
("", "@ID"),
("value", "@tops"),
]

myplot = figure(plot_width=1400,
               plot_height=800,
               title='test',
               y_axis_label="mean_enrichment",
               tools="save, wheel_zoom, reset, hover",
               tooltips = TOOLTIPS,
               x_range=my_x_range)

myplot.vbar(width=0.9,
           bottom=0,
           top='tops',
           x='ID',
           source = source)

#Nous ajoutons les barres d'erreurs
myplot.add_layout(bk.models.Whisker(source = source_error, 
                              base = "base", 
                              upper = "upper", 
                              lower = "lower", 
                              level="overlay"))

myplot.xaxis.major_label_orientation = math.pi/4
show(myplot)

Whisker annotation seems to work fine in bokeh 2.3.0dev2. @Lolopopo, can you try it out? You can install the dev version with:

conda create -n bk23dev2 -c bokeh/label/dev bokeh=2.3.0dev2
conda activate bk23dev2

I tried the dev install and it didn’t work. I got this message:

Collecting package metadata (current_repodata.json): done
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: /
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed

PackagesNotFoundError: The following packages are not available from current channels:

  - python_abi=3.9[build=*_cp39]

Current channels:

  - https://conda.anaconda.org/bokeh/label/dev/win-64
  - https://conda.anaconda.org/bokeh/label/dev/noarch
  - https://repo.anaconda.com/pkgs/main/win-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/win-64
  - https://repo.anaconda.com/pkgs/r/noarch
  - https://repo.anaconda.com/pkgs/msys2/win-64
  - https://repo.anaconda.com/pkgs/msys2/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.

Did you try to install it into some existing conda environment or into a new environment?

I first tried conda install -c bokeh/label/dev bokeh=2.3.0dev2 in one of my environments and it didn’t work. I then tried the complete command from my base environment and that’s when I got the error log I posted above

Huh, yeah, not sure what’s going on. I get this when trying different Python versions:

The following specifications were found to be incompatible with your system:

  - feature:/linux-64::__cuda==11.0=0

Yeah that’s what I got when I tried installing into my own env!

Not seeing any issues on OSX:

(dev) ❯ conda create -n bk23dev2 -c bokeh/label/dev bokeh=2.3.0dev2
Collecting package metadata (current_repodata.json): done
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 4.8.3
  latest version: 4.9.0

Please update conda by running

    $ conda update -n base -c defaults conda



## Package Plan ##

  environment location: /Users/bryan/anaconda/envs/bk23dev2

  added / updated specs:
    - bokeh=2.3.0dev2


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    bokeh-2.3.0dev2            |             py_0         6.8 MB  bokeh/label/dev
    certifi-2020.6.20          |   py39h2c36a5b_2         151 KB  conda-forge
    freetype-2.10.4            |       ha233b18_0         564 KB
    libopenblas-0.3.10         |       h0794777_0         4.5 MB
    lz4-c-1.9.2                |       h79c402e_3         130 KB
    markupsafe-1.1.1           |   py39h66d5b7b_2          25 KB  conda-forge
    numpy-1.19.2               |   py39h948a3a5_1         5.1 MB  conda-forge
    olefile-0.46               |             py_0          33 KB
    pillow-8.0.0               |   py39h31b929e_0         652 KB  conda-forge
    pip-20.2.4                 |             py_0         1.1 MB  conda-forge
    python-3.9.0               |       h88f2d9e_1         9.9 MB
    python_abi-3.9             |           1_cp39           4 KB  conda-forge
    pyyaml-5.3.1               |   py39h66d5b7b_1         180 KB  conda-forge
    setuptools-49.6.0          |   py39h2c36a5b_2         944 KB  conda-forge
    tornado-6.0.4              |   py39hb5aae12_2         644 KB  conda-forge
    typing_extensions-3.7.4.3  |             py_0          28 KB
    tzdata-2020c               |       h7b6447c_0         109 KB
    ------------------------------------------------------------
                                           Total:        30.8 MB

The following NEW packages will be INSTALLED:

What platforms is everyone on? I don’t understand a cuda conflict since Bokeh does has very few dependencies and none of them should bring in cuda AFAIK.

Edit: I guess I should add this is my channel pref:

           channel URLs : https://repo.anaconda.com/pkgs/main/osx-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/osx-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://conda.anaconda.org/bokeh/osx-64
                          https://conda.anaconda.org/bokeh/noarch
                          https://conda.anaconda.org/conda-forge/osx-64
                          https://conda.anaconda.org/conda-forge/noarch

Ubuntu 20.04.

I get the __cuda error when trying any Python version other than 3.9.

With 3.9 (or rather, without specifying Python explicitly) I get this:

The following packages are not available from current channels:

  - python_abi=3.9[build=*_cp39]

Either way, it seems to work if I add -c conda-forge. Not sure if it’s a Bokeh issue or something’s wrong with Anaconda.
@Lolopopo Can you try adding -c conda-forge to the arguments line and trying again?

So I tried again and I got a PackagesNotFoundError when installing into my test env:

(isoplot_bokeh_test) C:\>conda install -c conda-forge bokeh/label/dev bokeh=2.3.0dev2
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

  - bokeh=2.3.0dev2
  - bokeh/label/dev

Current channels:

  - https://conda.anaconda.org/conda-forge/win-64
  - https://conda.anaconda.org/conda-forge/noarch
  - https://repo.anaconda.com/pkgs/main/win-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/win-64
  - https://repo.anaconda.com/pkgs/r/noarch
  - https://repo.anaconda.com/pkgs/msys2/win-64
  - https://repo.anaconda.com/pkgs/msys2/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.

I tried creating the dev env using the command given above and with conda-forge as source and got the same error:

(base) C:\>conda create -n bk23dev2 -c conda-forge bokeh/label/dev bokeh=2.3.0dev2
Collecting package metadata (current_repodata.json): done
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed

PackagesNotFoundError: The following packages are not available from current channels:

  - bokeh/label/dev
  - bokeh=2.3.0dev2

Current channels:

  - https://conda.anaconda.org/conda-forge/win-64
  - https://conda.anaconda.org/conda-forge/noarch
  - https://repo.anaconda.com/pkgs/main/win-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/win-64
  - https://repo.anaconda.com/pkgs/r/noarch
  - https://repo.anaconda.com/pkgs/msys2/win-64
  - https://repo.anaconda.com/pkgs/msys2/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.

Ok so my bad I was being dumb, I tried installing using

conda create -n bk23dev2 -c conda-forge bokeh/label/dev -c conda-forge bokeh=2.3.0dev

and this time it worked! Only problem is I cannot install jupyterlab into the environment to actually test if the whiskers are working… any ideas on how to proceed?