JupyterLab: WebGL is not supported by your browser
Asked Answered
D

2

12

When I'm trying to make 3D plots in JupyterLab using plotly, I sometimes get the error message:

WebGL is not supported by your browser - visit https://get.webgl.org for more info

What is going on here? Similar questions have been asked for

but none seem to be asked specifically for JupyterLab, so I'm hoping some of you have an idea why this error occurs.


The details:

I'm running different tests on the following script that produces the plot below:

Code:

import plotly.graph_objects as go
import numpy as np

# Helix equation
t = np.linspace(0, 20, 100)
x, y, z = np.cos(t), np.sin(t), t

fig = go.Figure(data=[go.Scatter3d(
    x=x,
    y=y,
    z=z,
    mode='markers',
    marker=dict(
        size=12,
        color=z,                # set color to an array/list of desired values
        colorscale='Viridis',   # choose a colorscale
        opacity=0.8
    )
)])

# tight layout
fig.update_layout(margin=dict(l=0, r=0, b=0, t=0))
fig.show()

Plot:

enter image description here

Seemingly depending on what I'm trying to do here, the above mentioned error occurs from time to time. And that's what bothers me the most; there just does not seem to be a clear pattern here. Sometimes the plot is displayed briefly, and then the error message pops up. And other times it just completely breaks. And when it first breaks, restarting the kernel does not help. Neither does launching JupyterLab again. The only thing that helps is to restart the computer.

When I click the error message in JupyterLab:

enter image description here

I'm being directed to https://get.webgl.org/ that displays:

enter image description here

And that's not exaclty very helpful? Any ideas anyone?

System info:

Plotly 4.2.0
JupyterLab Version 0.34.9
Python 3.7.0 (default, Jun 28 2018, 08:04:48) [MSC v.1912 64 bit (AMD64)]
Chrome 77 on Windows 7, 64 bit ( not that that should matter?)
Drug answered 29/10, 2019 at 21:10 Comment(4)
are you running the Jupyter kernel remotely?Telecast
@Telecast I'm running everything locally on my computer.Drug
I've got the same problem except I'm running it on a remote server and inside a hydrogen environment. That excludes problems with remote kernels and interactive environments. How about this plotly example? I can run this one fine. Can you?Telecast
I got this problem when I tried to set the width of the plotly express line graph to a very high value. Restarting the kernel did not solve the problem. Restarting the whole application (restarting the project in jupyter notebook) could able to avoid the problem.Entitle
T
1

I was experiencing the same issue using jupyter notebook through Firefox, with up-to-date graphics drivers. On Firefox I was able to solve this by changing the webgl.disabled setting from True to False.

Type "about:config" in the address bar. Click proceed with caution, then type "webgl.disabled" and make sure the setting is saved as False.

Tootle answered 24/10, 2020 at 20:12 Comment(1)
That's a really interesting suggestion! Looking forward to testing it myself!Drug
D
0

I also encountered the same problem, I was able to solve it with the help of changing the render-mode, by default render-mode is set to 'auto' which turns it into WebGL if you set the render_mode='svg' it will work most likely.

For example:

fig = px.scatter(..., render_mode='svg')
Deedee answered 17/1 at 16:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.