Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while running notebooks in VS Code #194

Open
alexgleith opened this issue May 17, 2023 · 3 comments
Open

Error while running notebooks in VS Code #194

alexgleith opened this issue May 17, 2023 · 3 comments

Comments

@alexgleith
Copy link

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
@mattpap
Copy link
Contributor

mattpap commented May 18, 2023

bokeh==2.4.3
jupyter-bokeh==2.0.4

It looks like jupyter-bokeh compatible with bokeh 2.4 was never published. The last working version is probably bokeh 2.3. Note that holoviz stack based on bokeh 3 was published yesterday, so if you don't mind updating your dependencies, then this may be a non-issue for you. We probably will want to make a retroactive 2.0.5 release anyway.

@alexgleith
Copy link
Author

I have a working local environment now. It was pretty hard to work out what needed to change, but this combination is ok:

bokeh==2.4.3
jupyter-bokeh==3.0.5

Can render in VS Code now, although I can't work out if I need to execute this or not: hv.extension('bokeh')

@bryevdv
Copy link
Member

bryevdv commented May 18, 2023

although I can't work out if I need to execute this or not: hv.extension('bokeh')

Holoviews is a separate project, that's really a question for them: https://discourse.holoviz.org but there may also be useful information here: bokeh/bokeh#10765

TLDR; Microsoft does not use standard websockets and that's an issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants