You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

DataSpell(JetBrains)中Jupyter Notebook报错“WebGL is not supported by your browser …”问题求助

Fixing "WebGL is not supported by your browser" Error for Plotly 3D Surface Plots in DataSpell Jupyter Notebooks

Why This Happens

Your Anaconda/Jupyter setup uses your system's default browser (Chrome, Firefox, etc.) which natively supports WebGL for rendering Plotly's 3D graphics. However, DataSpell's Jupyter Notebook relies on the built-in JetBrains Runtime WebView to display plots, and this component might have WebGL disabled by default or lack proper support for it.

Solutions to Try

1. Force Plotly to Use SVG Rendering

Plotly defaults to WebGL for 3D plots to boost performance, but we can explicitly switch to SVG rendering which works in more environments. Modify your code like this:

import plotly.graph_objects as go
import pandas as pd

z_data = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/api_docs/mt_bruno_elevation.csv')
# Add render_type='svg' to the Surface trace to avoid WebGL dependency
fig = go.Figure(data=[go.Surface(z=z_data.values, render_type='svg')])
fig.update_layout(title='Mt Bruno Elevation', autosize=False, width=500, height=500, margin=dict(l=65, r=50, b=65, t=90))
fig.show()

This will render the plot without relying on WebGL, though you might notice slightly slower performance with very large datasets.

2. Enable WebGL in DataSpell's WebView Settings

Check if DataSpell's internal WebView has WebGL disabled:

  • Open DataSpell Settings: File > Settings (Windows/Linux) or DataSpell > Settings (Mac)
  • Navigate to Build, Execution, Deployment > Debugger > WebView
  • Make sure the Enable WebGL checkbox is ticked. If it wasn't, restart DataSpell after enabling it and re-run your notebook.

3. Configure Plotly to Render in Your Default Browser

If you prefer to replicate the Anaconda/Jupyter behavior, you can tell Plotly to open plots directly in your system's default browser instead of DataSpell's WebView:

import plotly.io as pio
# Set default renderer to your system browser
pio.renderers.default = 'browser'

# Rest of your code remains the same
import plotly.graph_objects as go
import pandas as pd

z_data = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/api_docs/mt_bruno_elevation.csv')
fig = go.Figure(data=[go.Surface(z=z_data.values)])
fig.update_layout(title='Mt Bruno Elevation', autosize=False, width=500, height=500, margin=dict(l=65, r=50, b=65, t=90))
fig.show()

Running this will pop up your default browser to display the 3D surface plot, bypassing DataSpell's internal renderer entirely.

4. Update DataSpell to the Latest Version

Sometimes WebGL support issues are fixed in newer releases. Update DataSpell to the latest version:

  • Go to Help > Check for Updates
  • Install any available updates and restart the IDE before testing your code again.

内容的提问来源于stack exchange,提问作者len

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.30 21:04:09