jupyter_bokeh: Not working in VS Code

THIS IS A COPY OF https://github.com/holoviz/panel/issues/2145

OS: Windows Python: 3.8 Panel: current master jupyter_bokeh: 3.0.0 notebook: 6.3.0

I can see that the current Panel MASTER branch does not work in VS Code via jupyter_bokeh.

Steps

python -m venv .venv
source .venv/Scripts/activate
pip install git+https://github.com/holoviz/panel.git
pip install jupyter_bokeh

In the Jupyter interactive notebook run (select code and click SHIFT+ENTER).

import panel as pn
pn.extension(comms='vscode')
pn.pane.Markdown("Hello")

and see the error

Error

Error: Module @bokeh/jupyter_bokeh, semver range ^3.0.0 is not registered as a widget module

Screenshot

image

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 20 (10 by maintainers)

Most upvoted comments

FYI. I’m working on enabling Panel users to explore the example and gallery notebooks on Binder. And I have installed VS Code there as well. My aim is to show how powerful a combination Panel and VS Code can be. Especially with the --autoreload. But for now it would not work with the versions 3.0 of jupyter lab.

https://user-images.githubusercontent.com/42288570/115116153-7911ff00-9f98-11eb-97bd-8228ae1ac840.mp4

And I would also like to be able to offer the powerful combination of Panel and VS Code on a Jupyter Hub at work 😃

That’s on me. Will work on that tomorrow.

I faced exactly the same issue as @xareelee (no output rendering inside vscode, but working in browser jupyter-lab for instance ; using all the latest versions of panel, jupyter_bokeh at the time of my writing). For me, the problem was due to the BokehJS library not being loaded. I found it by looking at the logs in devtools (Ctrl+Shift+P > Toggle Developer Tools), it was showing warning messages:

Bokeh: BokehJS was loaded multiple times but one version failed to initialize.

and

Panel: ERROR: Unable to run Panel because Bokeh or Panel library is missing

Solution was to run following line:

import bokeh.io
bokeh.io.output_notebook()

It prints “BokehJS 3.3.2 successfully loaded.” and after that, panel widgets work!

Yes, I just released 3.0.2 to PyPI and NPM with the needed fixes. Should work now.

@bryevdv I’d be happy to take a stab at automation. If I could get 20 minutes of your time, maybe on Friday I’ll try to set that up on GH Actions. Are the PyPI, conda and npm tokens already set up as Bokeh Org secrets?

I’m not sure what you are trying to say here?

I’m saying that pointing out that the combination of jlab 3.x and jupyter_bokeh 2.x do not function together (“comms after downgrading do not work”, which has nothing to do with vscode) is very much redundant and unnecessary at this point.

As I understand this comment you recognize that VS Code is not working with version 3.0 of this package?

I don’t use VScode for anything except an editor, and I don’t really use Jupyter at all either, so I will certainly take your word for it.

I can see that the comms after downgrading do not work as nothing happens when I click the button.

image

UPDATE: downgrading does not solve the problem. See below comments.

I can see that running pip install jupyter_bokeh==2.0.0 solves the problem.

image

So some how/ some where I guess VS code is running on jupyterlab 2.x ??

image