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

[BUG] [WebGL] Blank figures in Jupyter Lab Desktop #13665

Closed
alcrene opened this issue Jan 25, 2024 · 5 comments
Closed

[BUG] [WebGL] Blank figures in Jupyter Lab Desktop #13665

alcrene opened this issue Jan 25, 2024 · 5 comments

Comments

@alcrene
Copy link

alcrene commented Jan 25, 2024

Software versions

Python version: 3.11 (conda environment installed with jlab env create)

Package                   Version
------------------------- ---------------
bokeh                     3.3.3
ipykernel                 6.29.0
ipython                   8.20.0
ipython-genutils          0.2.0
ipywidgets                8.1.1
jsonschema                4.21.1
jsonschema-specifications 2023.12.1
jupyter-bokeh             3.0.7
jupyter_client            7.4.9
jupyter_core              5.7.1
jupyter-events            0.9.0
jupyter_server            2.12.5
jupyter_server_fileid     0.9.1
jupyter_server_terminals  0.5.2
jupyter_server_ydoc       0.8.0
jupyter-ydoc              0.2.4
jupyterlab                3.6.7
jupyterlab_pygments       0.3.0
jupyterlab_server         2.25.2
jupyterlab-widgets        3.0.9
nbformat                  5.9.2
notebook                  6.5.6
notebook_shim             0.2.3
PySocks                   1.7.1
requests                  2.31.0
stack-data                0.6.2
terminado                 0.18.0
tinycss2                  1.2.1
tornado                   6.3.3
traitlets                 5.14.1
tzdata                    2023.4
uri-template              1.3.0
urllib3                   2.1.0
webencodings              0.5.1
websocket-client          1.7.0
widgetsnbextension        4.0.9
ypy-websocket             0.8.2

Browser name and version

Jupyter Lab Desktop

Jupyter notebook / Jupyter Lab version

4.0.11

Expected behavior

I’ve been experimenting with Jupyter Lab Desktop and ran into a weird issue with bokeh plots not being displayed.

I would expect inlined bokeh plots to work equally well whether I use JL Desktop or run Jupyter Lab in a browser.

Observed behavior

In JL Desktop, the bokeh figure is mostly blank (only the background grid appears).
The javascript console shows fatal errors related to WebGL.

Capture d’écran du 2024-01-25 13-06-24

This seems to occur only when I create Bokeh plots from within JL Desktop.
It does not occur if I activate the underlying conda environment myself and start Jupyter Lab from the console (thus running it in a browser.)

Steps to reproduce the screenshot above:

jlab env create /opt/jld_bokeh_test "python==3.11" bokeh holoviews

(Installing jupyter_bokeh also made no difference.)

From within JLD, select Settings -> Server -> Custom Python environment -> opt/jld_bokeh_test

Then I run a test notebook with the code listed below

Example code

from bokeh.plotting import figure
from bokeh.io import output_notebook, show

output_notebook()
p = figure(output_backend="webgl")
p.line(x=list(range(8)), y=list(range(8)))
show(p)

Stack traceback or browser console output

This is part of the console output shown in the screenshot.

47.700864e51bfa92f76faf.js?v=700864e51bfa92f76faf:1 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'sessionContext')
    at get comm [as comm] (47.700864e51bfa92f76faf.js?v=700864e51bfa92f76faf:1:3711)
    at S._disposePlot (47.700864e51bfa92f76faf.js?v=700864e51bfa92f76faf:1:11210)
    at S.dispose (47.700864e51bfa92f76faf.js?v=700864e51bfa92f76faf:1:11697)
    at t.dispose (jlab_core.7f4f9f24c6ff497f974f.js?v=7f4f9f24c6ff497f974f:2:1642297)
    at e.dispose (jlab_core.7f4f9f24c6ff497f974f.js?v=7f4f9f24c6ff497f974f:2:1626151)
    at t.dispose (jlab_core.7f4f9f24c6ff497f974f.js?v=7f4f9f24c6ff497f974f:2:1642297)
    at e.dispose (jlab_core.7f4f9f24c6ff497f974f.js?v=7f4f9f24c6ff497f974f:2:1626151)
    at j.dispose (jlab_core.7f4f9f24c6ff497f974f.js?v=7f4f9f24c6ff497f974f:2:957306)
    at t.dispose (jlab_core.7f4f9f24c6ff497f974f.js?v=7f4f9f24c6ff497f974f:2:1642297)
    at e.dispose (jlab_core.7f4f9f24c6ff497f974f.js?v=7f4f9f24c6ff497f974f:2:1626151)
VM154 bokeh-gl-3.3.3.min.js:47 Error linking program with vertex shader, "unknown", and fragment shader "unknown"
VM154 bokeh-gl-3.3.3.min.js:47 Error: (regl) Error linking program with vertex shader, "unknown", and fragment shader "unknown"
    at Function.n [as raise] (bokeh-gl-3.3.3.min.js:47:444)
    at Function.linkError (bokeh-gl-3.3.3.min.js:47:5133)
    at p (bokeh-gl-3.3.3.min.js:47:100546)
    at Object.program (bokeh-gl-3.3.3.min.js:47:101831)
    at bokeh-gl-3.3.3.min.js:47:58974
    at B (bokeh-gl-3.3.3.min.js:47:59372)
    at Object.compile (bokeh-gl-3.3.3.min.js:47:80191)
    at ke (bokeh-gl-3.3.3.min.js:47:116331)
    at bokeh-gl-3.3.3.min.js:46:7026
    at b.solid_line (bokeh-gl-3.3.3.min.js:46:7031)

Screenshots

This was originally reported on the Holoviews bug tracker.

@mattpap
Copy link
Contributor

mattpap commented Jan 25, 2024

This may be a problem with electoron.js. @alcrene, maybe you could try the suggestion from electron/electron#40684 (comment)?

@alcrene
Copy link
Author

alcrene commented Jan 25, 2024

That seems to be the case. JLab Desktop uses its own cache folders (~/.Electron doesn’t exist on my machine) , so to be sure I removed everything that had the word “cache” in its config folder:

cd .config/jupyterlab-desktop
mv Cache Code\ Cache DawnCache GPUCache ~/tmp/jlab-caches/

Sure enough, after doing that I could relaunch Jupyter Lab Desktop and the example above worked as expected.

@bryevdv
Copy link
Member

bryevdv commented Jan 25, 2024

I'm not sure there is anything we can do on our end apart from maybe a note in the docs

@alcrene
Copy link
Author

alcrene commented Jan 25, 2024

Something that would have been very helpful when tracking this down would have more information on the figure itself. (It took me a while to think to open the JS console, and I think it’s safe to say most users would never think of that.)
No idea how feasible it is, but I am imagining a message like the following:

An issue occurred while attempting to load WebGL.
Refer to this troubleshooting page for possible fixes: [link to docs]

(Taking care of course that the message would be displayed even after an error in the javascript stack.)

@bryevdv
Copy link
Member

bryevdv commented Jan 26, 2024

@alcrene sure, but there's going to have to be some kind of generic mechanism to catch and surface errors, since individually crafting an error message for every conceivable situation is very far outside the realm of possible (there would be thousands or more). However, AFAIK there is already nominally an issue for that: #6884 though it may need some updating or re-triaging, or maybe a new issue should be opened to replace that discussion issue. cc @mattpap

In any case I will close this one.

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