Open
Description
The issue is that plotly's template system has a circular import dependency:
plotly.graph_objs.__init__.py
imports all trace types including Heatmapgl- During this import process, it also loads template data
layout/template/data/_heatmapgl.py
tries toimport Heatmapgl from plotly.graph_objs
- But plotly.graph_objs is still in the process of being imported!
This occurred when attempting to use plotly and plotly-resampler and a heatmap.
Reproduction of Error
Minimal reproduction code:
import plotly.graph_objs as go
go.Heatmapgl() # ✅ Success
# But this fails:
from plotly_resampler import FigureResampler
fig = FigureResampler(go.Figure()) # ❌ Circular import
Versions affected:
plotly==5.24.1
plotly-resampler==0.10.0
Work around
This can be worked around by forcing import order:
import plotly.graph_objs # Force full initialization first
from plotly_resampler import FigureResampler # Then import resampler