Some observations on: ModuleNotFoundError: 'No module named 'bokeh.models.arrow_heads''

I have holoviews==1.14.5 installed in a conda environment on MacOS. The installation of that package also provided bokeh==3.1.1. From that environment I launch Jupyter Lab where amongst other things I import holoviews. When I go to set the extension using hv.exetnsion('bokeh') I get the following error:

WARNING:param.notebook_extension: Holoviews bokeh extension could not be imported, it raised the following exception: ModuleNotFoundError('No module named 'bokeh.models.arrow_heads'')

After a bit of googling I saw a recommendation to try importing the backend using from holoviews.plotting import bokeh. This seemed to better show where the import problem was. Is that correct? The stack trace looks like this:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
File ~/opt/miniconda3/envs/skorchy/lib/python3.10/site-packages/holoviews/plotting/bokeh/annotation.py:12
     11 try:
---> 12     from bokeh.models.arrow_heads import TeeHead, NormalHead
     13     arrow_start = {'<->': NormalHead, '<|-|>': NormalHead}

ModuleNotFoundError: No module named 'bokeh.models.arrow_heads'

During handling of the above exception, another exception occurred:

ModuleNotFoundError                       Traceback (most recent call last)
Cell In[4], line 1
----> 1 from holoviews.plotting import bokeh

File ~/opt/miniconda3/envs/skorchy/lib/python3.10/site-packages/holoviews/plotting/bokeh/__init__.py:26
     23 except:
     24     DFrame = None
---> 26 from .annotation import (
     27     TextPlot, LineAnnotationPlot, BoxAnnotationPlot, SplinePlot, ArrowPlot,
     28     DivPlot, LabelsPlot, SlopePlot
     29 )
     30 from ..plot import PlotSelector
     31 from ..util import fire

File ~/opt/miniconda3/envs/skorchy/lib/python3.10/site-packages/holoviews/plotting/bokeh/annotation.py:17
     14     arrow_end = {'->': NormalHead, '-[': TeeHead, '-|>': NormalHead,
     15                  '-': None}
     16 except:
---> 17     from bokeh.models.arrow_heads import OpenHead, NormalHead
     18     arrow_start = {'<->': NormalHead, '<|-|>': NormalHead}
     19     arrow_end = {'->': NormalHead, '-[': OpenHead, '-|>': NormalHead,
     20                  '-': None}

ModuleNotFoundError: No module named 'bokeh.models.arrow_heads'

When I look at the referenced files it seems no surprise the module is not found. The from bokeh.models.arrow_heads doesn’t exist. The path I found seems to be bokeh.models.annotations.arrows. When I modify the path, that corrects that error. So, am I reading that correctly ie. the problem is that the paths have changed?

image

The challenge is that I didn’t explicitly install the bokeh version used, it was installed by the holoviews installation. Is this a case of the wrong bokeh version for the holoviews version?

I have the same problem.

You need to update to Holoviews=1.16 and Bokeh=3.1.1

2 Likes