Skip to content

Error while running notebooks in VS Code #194

Open
@alexgleith

Description

@alexgleith

If I run a simple example like the below in VS Code:

import numpy as np
import holoviews as hv

def sine_curve(phase, freq):
    xvals = [0.1* i for i in range(100)]
    return hv.Curve((xvals, [np.sin(phase+freq*x) for x in xvals]))

# When run live, this cell's output should match the behavior of the GIF below
dmap = hv.DynamicMap(sine_curve, kdims=['phase', 'frequency'])
dmap.redim.range(phase=(0.5,1), frequency=(0.5,1.25))

I get the error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
File [/opt/homebrew/lib/python3.11/site-packages/jupyter_bokeh/widgets.py:133](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/lib/python3.11/site-packages/jupyter_bokeh/widgets.py:133), in BokehModel._sync_model(self, _, content, _buffers)
    131         cb(attr, old, new)
    132 elif kind == 'MessageSent':
--> 133     self._document.apply_json_event(content["msg_data"])

AttributeError: 'Document' object has no attribute 'apply_json_event'

Libraries I have installed include:

  • bokeh==2.4.3
  • jupyter-bokeh==2.0.4
  • notebook==6.5.4
  • holoviews==1.16.0
  • hvplot==0.8.3

VS Code is: 1.78.2 running on a M1 mac.

Also note that if I run the same example in Jupyter Lab on the same machine it renders fine, but seems to not have interactivity.

image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions