bokeh / jupyter_bokeh

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

Make version mismatches visible to users #128

Open jiagengliu opened 3 years ago

jiagengliu commented 3 years ago

Hi! Thank you so much for providing the brilliant package.

Matplotlib inline works in my Jupyterlab notebook, but not Bokeh (or Holoviews). See the screenshot below. I am able to get the "BokehJS 2.2.3 successfully loaded" message when I re-run the code cell to import Bokeh, but there is still no figure output. I am using JupyterLab 3.0.12, Bokeh 2.3.0, Python 3.8.5 on Ubuntu 20.04. There is no particular output in Jupyter's command line, either. I wonder what might be the reason? Thank you!

bryevdv commented 3 years ago

cc @philippjfr @mattpap

bryevdv commented 3 years ago

@jiagengliu I just noticed this:

"BokehJS 2.2.3 successfully loaded"

If you see that then your notebook environment is definitely not using Bokeh 2.3 you should first make sure that you have the Bokeh 2.3 installed in the same env as the jupyterlab. E.g. you can check bokeh.__version__

jiagengliu commented 3 years ago

@jiagengliu I just noticed this:

"BokehJS 2.2.3 successfully loaded"

If you see that then your notebook environment is definitely not using Bokeh 2.3 you should first make sure that you have the Bokeh 2.3 installed in the same env as the jupyterlab. E.g. you can check bokeh.__version__

Thank you! I checked and weirdly enough, it says Bokeh 2.3.0. See below. I only use pip to install packages and I don't have conda or other virtualenvs.

image

jiagengliu commented 3 years ago

I checked the browser JS and see the following error messages.

[bokeh] JS/Python version mismatch
from_json @ VM827:287
VM827:287 [bokeh] Library versions: JS (2.2.3) / Python (2.3.0)
from_json @ VM827:287

Uncaught Error: Model 'AllLabels' does not exist. This could be due to a widget or a custom model not being registered before first usage.
    at Object.s.Models (<anonymous>:288:204)
    at Function._instantiate_object (<anonymous>:287:4891)
    at Function._instantiate_references_json (<anonymous>:287:5050)
    at Function.from_json (<anonymous>:287:8363)
    at Object.t.embed_items_notebook (<anonymous>:700:2975)
    at embed_document (<anonymous>:6:20)
    at <anonymous>:10:5
    at <anonymous>:26:3
    at a.renderModel (809.9e119e998e669aa9de3a.js?v=9e119e998e669aa9de3a:1)
translate.js:1112 Uncaught (in promise) Error: getTranslators: detection is already running
    at Zotero.Translate.Web.<anonymous> (translate.js:1112)
    at Zotero.Translate.Web.getTranslators (promise.js:34)
    at Object.init (inject.js:104)
    at Object.historyChanged (inject.js:675)
    at messageListener (messaging_inject.js:122)
    at messaging_inject.js:132
bryevdv commented 3 years ago

There seems to be something really messed up in this environment. Can you try installing all of the following in a clean env?

philippjfr commented 3 years ago

I think the old bokeh.js is sticking around in the notebook. Can you try clearing the notebook, saving, then reload the browser tab and try again.

jiagengliu commented 3 years ago

I think the old bokeh.js is sticking around in the notebook. Can you try clearing the notebook, saving, then reload the browser tab and try again.

Thank you! I restarted the browser and it worked. I never thought that the problem is because I seldom close the browser.

Thanks again for the rapid response. I will close it now.

philippjfr commented 3 years ago

We should still try to figure out a fix here, a new version of bokeh should override the old one. The problem is particularly bad in Jupyterlab where an old version of bokeh in one tab may override the newer version in another if it is loaded first.

bryevdv commented 3 years ago

I would be satisfied to simply make the error message about the mismatch visible within the notebook. That ought to give users something concrete to search or, or we could even suggest a course of action there.

jiagengliu commented 3 years ago

I think the old bokeh.js is sticking around in the notebook. Can you try clearing the notebook, saving, then reload the browser tab and try again.

I encounter the problem again today. The reason seems to be that sometimes I use Windows WSL to ssh to a server and use Jupyter and sometimes use Jupyter on my local WSL. My local machine uses the 2.2.3 version and the server uses the 3.0.0 version, so the browser probably memorizes it and does not switch? I upgrade the local version to 3.0.0 now, but I think it might be useful info.

Thanks again!