Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Circular Import Dependency in Plotly Templates #5281

Open
Assignees
Labels
P1needed for current cycle bugsomething broken
@chorsington

Description

The issue is that plotly's template system has a circular import dependency:

  1. plotly.graph_objs.__init__.py imports all trace types including Heatmapgl
  2. During this import process, it also loads template data
  3. layout/template/data/_heatmapgl.py tries to import Heatmapgl from plotly.graph_objs
  4. 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

Metadata

Metadata

Labels

P1needed for current cycle bugsomething broken

Type

No type

Projects

No projects

Milestone

No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      AltStyle によって変換されたページ (->オリジナル) /