bokeh / jupyter_bokeh

An extension for rendering Bokeh content in JupyterLab notebooks
BSD 3-Clause "New" or "Revised" License
254 stars 47 forks source link

Failed to register jupyter_bokeh #201

Open obrown06 opened 7 months ago

obrown06 commented 7 months ago

I'm trying to integrate a Tabulator into a Voila application as follows:

import pandas as pd
import panel as pn
pn.extension('tabulator')

df = pd.DataFrame(...)
df_widget = pn.ipywidget(pn.widgets.Tabulator(df))

I'm getting the following rendered error:

Failed to load model class 'BokehModel' from module '@bokeh/jupyter_bokeh'

And the following errors in the javascript console:

Plugin '@bokeh/jupyter_bokeh' failed to activate.
TypeError: No provider for: jupyter.extensions.jupyterWidgetRegistry.
Error: No version of module @bokeh/jupyter_bokeh is registered

The relevant package versions:

bokeh                     3.4.0
ipywidgets                8.1.2
jupyter                   1.0.0
jupyter_bokeh             4.0.1
jupyterlab                4.0.11
jupyterlab_widgets        3.0.10
panel                     1.4.1
python                    3.10.14

Anyone have an idea what might be going wrong here? Happy to redirect the query elsewhere if this isn't the right place. Thanks!

bryevdv commented 7 months ago

According to a Jupyter core dev

That indicates that the Jupyter widgets extension is not installed. Assuming your server is running jlab 3, it can be installed by installing ipywidgets 7.6+ or by installing jupyterlab_widgets 1.0+.

Is it possible you have an environment mixup and jupyterlab_widgets is not installed in the same environment you think it is?

Edit: But I guess that thread goes on to indicate that other scenarios can also cause this to happen. That's outside my expertise thought cc @philippjfr @mattpap

obrown06 commented 7 months ago

FWIW: I'm using Conda and it seems like jupyterlab_widgets is definitely installed:

conda list | grep jupyterlab_widgets
jupyterlab_widgets        3.0.10
obrown06 commented 7 months ago

Also, it looks like at least someone else may be hitting the same issue: https://community.deeplearning.ai/t/replicating-chatbot-implementation-with-huggingface-open-source-models/596117.

Kalandoros commented 6 months ago

I got the same issue. This is not new issue. It's already persising for longer

jupyter_bokeh 4.0.4 jupyter_client 8.1.0 jupyter_core 5.3.0 jupyter-events 0.7.0 jupyter-lsp 2.2.0 jupyter_server 2.7.3 jupyter_server_terminals 0.4.4 jupyterlab 4.2.1 jupyterlab-pygments 0.2.2 jupyterlab_server 2.27.2 jupyterlab_widgets 3.0.10 panel 1.4.3 voila 0.5.7

labextensions: @bokeh/jupyter_bokeh v4.0.4 enabled ok (python, jupyter_bokeh) @pyviz/jupyterlab_pyviz v3.0.2 enabled ok

image

You may also have a look here: https://github.com/voila-dashboards/voila/issues/1435 I am pretty sure that this is related. Unfortunately, due to a lack of knowledge, I am not in a position to make any further investigatens.

MarcSkovMadsen commented 3 months ago

+1. Me and my colleague have the same issue when trying to use Panel in VS Code interactive environment.

I can replicate in his environment with the following steps

python -m venv .venv
source .venv/bin/activate
pip install panel jupyter_bokeh ipykernel

Open the Jupyter Interactive environment

Run

import panel as pn

pn.extension()
pn.panel("Hello World")

image

When I click Click to show javascript error I see

Failed to load model class 'BokehModel' from module '@bokeh/jupyter_bokeh'
Error: No version of module @bokeh/jupyter_bokeh is registered

Versions

os: linux python extension: v2024.4.1 jupyter extension: v2023.3.100

package versions ```bash asttokens==2.4.1 bleach==6.1.0 bokeh==3.4.3 certifi==2024.7.4 charset-normalizer==3.3.2 comm==0.2.2 contourpy==1.2.1 debugpy==1.8.5 decorator==5.1.1 executing==2.0.1 idna==3.7 ipykernel==6.29.5 ipython==8.26.0 ipywidgets==8.1.3 jedi==0.19.1 Jinja2==3.1.4 jupyter_bokeh==4.0.5 jupyter_client==8.6.2 jupyter_core==5.7.2 jupyterlab_widgets==3.0.11 linkify-it-py==2.0.3 Markdown==3.6 markdown-it-py==3.0.0 MarkupSafe==2.1.5 matplotlib-inline==0.1.7 mdit-py-plugins==0.4.1 mdurl==0.1.2 nest-asyncio==1.6.0 numpy==2.0.1 packaging==24.1 pandas==2.2.2 panel==1.4.5 param==2.1.1 parso==0.8.4 pexpect==4.9.0 pillow==10.4.0 platformdirs==4.2.2 prompt_toolkit==3.0.47 psutil==6.0.0 ptyprocess==0.7.0 pure_eval==0.2.3 Pygments==2.18.0 python-dateutil==2.9.0.post0 pytz==2024.1 pyviz_comms==3.0.3 PyYAML==6.0.1 pyzmq==26.1.0 requests==2.32.3 six==1.16.0 stack-data==0.6.3 tornado==6.4.1 tqdm==4.66.5 traitlets==5.14.3 typing_extensions==4.12.2 tzdata==2024.1 uc-micro-py==1.0.3 urllib3==2.2.2 wcwidth==0.2.13 webencodings==0.5.1 widgetsnbextension==4.0.11 xyzservices==2024.6.0 ```
code-server: v4.23.1
Code: 1.88.1
Commit: 9a28bc29dbddb6886dfe03dc1c31320249a901ce
Date: 2024-04-15T23:01:57.805Z (3 mos ago)
Browser: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36 Edg/127.0.0.0
MarcSkovMadsen commented 3 months ago

I have managed to get this working in one case. What is below

After each step I tried. Only after the last step it fully worked.

I will try to find a receipe that will work from scratch

MarcSkovMadsen commented 3 months ago

In another JupyterHub I see the below in my browser console

Error: Unable to read file 'vscode-remote://MY.DOMAIN/vscode-resource?{"requestResourcePath":"/home/jovyan/.local/share/code-server/extensions/ms-toolsai.jupyter-2024.3.1-universal/temp/scripts/af7cfb460b26abe4dbd921151f82f0407a7a48377d4530dbeb78bbfab664c42b/jupyter/@bokeh/jupyter_bokeh.js"}' (Error: Unable to resolve nonexistent file 'vscode-remote://mnr-jupyterhub.de-prod.dk/vscode-resource?{"requestResourcePath":"/home/jovyan/.local/share/code-server/extensions/ms-toolsai.jupyter-2024.3.1-universal/temp/scripts/af7cfb460b26abe4dbd921151f82f0407a7a48377d4530dbeb78bbfab664c42b/jupyter/@bokeh/jupyter_bokeh.js"}')
    at n.F (fileService.ts:631:10)
    at n.D (fileService.ts:616:15)
    at async v (resourceLoading.ts:68:18)
    at async M.yb (webviewElement.ts:743:19)

I don't believe the path MY.DOMAIN/vscode-resource is valid. I.e. there is some proxy issue.

bryevdv commented 3 months ago

cc @philippjfr for any thoughts

MarcSkovMadsen commented 3 months ago

I was not able to use steps above to find solution on the other JupyterHub.

contang0 commented 1 month ago

panel version 1.4.5 does not have this issue. I installed the latest version, and running pn.extension() triggers the following error:

Unable to find widget '@bokeh/jupyter_bokeh' version '^4.0.5' from configured widget sources ["jsdelivr.com","unpkg.com"]. Expected behavior may be affected. Click here for more information.
Sources

Downgraded to 1.4.5 and the error is gone.

philippjfr commented 1 month ago

Sorry, missed this entirely. Will have to do some digging because 4.0.5 definitely does exist on npm:

https://www.npmjs.com/package/@bokeh/jupyter_bokeh?activeTab=versions

samimia-swks commented 3 days ago

Possibly the same issue : https://github.com/bokeh/jupyter_bokeh/issues/209