Summary
univariate_densities calls plotly.figure_factory.create_distplot, which was removed
in plotly 7.0.0. The function raises AttributeError with any plotly 7 installation,
and pyproject.toml allows plotly 7 to be installed.
Reproduction
plotly 7.0.0
has create_distplot: False
import plotly.figure_factory as ff
ff.create_distplot(...)
# AttributeError: module 'plotly.figure_factory' has no attribute 'create_distplot'
Call site: src/skillmodels/common/visualize_factor_distributions.py:255
fig = ff.create_distplot(hist_data, **distplot_kwargs)
create_distplot is the only figure_factory use in the package:
src/skillmodels/common/visualize_factor_distributions.py:11:import plotly.figure_factory as ff
src/skillmodels/common/visualize_factor_distributions.py:209: ff.create_distplot().
src/skillmodels/common/visualize_factor_distributions.py:255: fig = ff.create_distplot(hist_data, **distplot_kwargs)
Background
plotly 7.0.0 (released 2026-08-25) removed a group of long-deprecated figure factories,
create_distplot among them, along with create_2d_density,
create_annotated_heatmap, create_violin, create_scatterplotmatrix and others. See
Changes in version 7. The documented
replacement for create_distplot is px.histogram() with the marginal argument.
Impact
univariate_densities is unusable on plotly 7. Anything calling it fails at runtime, so
combine_distribution_plots is affected wherever it is fed univariate densities.
This is particularly awkward for projects running inside secure environments, where the
conda environment is built once by an administrator and cannot be changed by the
researcher. If the environment happened to resolve plotly 7, the function cannot be used
at all and there is no local remedy.
Suggested fix
Two parts, the first of which is worth doing regardless:
- Constrain the dependency so an incompatible plotly cannot be installed silently —
plotly>=6.6,<7 until the call is migrated.
- Migrate off the removed factory.
px.histogram(..., marginal=...) is the
documented path. Note that create_distplot's show_hist / show_curve /
show_rug switches do not map one-to-one, so the replacement is an API decision
rather than a drop-in substitution — in particular whether the KDE curve stays
available on its own, without a histogram.
A regression test that imports and calls univariate_densities would have caught this;
there does not appear to be one exercising the plotting path against the installed
plotly.
Related
The rug option is worth a thought while this is being reworked: show_rug=True places
one marker per observation in the figure, which is individual-level data. Projects
working under statistical disclosure rules cannot release such a figure. Not a bug, but
relevant to whichever replacement API is chosen, and related to #98.
Summary
univariate_densitiescallsplotly.figure_factory.create_distplot, which was removedin plotly 7.0.0. The function raises
AttributeErrorwith any plotly 7 installation,and
pyproject.tomlallows plotly 7 to be installed.Reproduction
Call site:
src/skillmodels/common/visualize_factor_distributions.py:255create_distplotis the onlyfigure_factoryuse in the package:Background
plotly 7.0.0 (released 2026-08-25) removed a group of long-deprecated figure factories,
create_distplotamong them, along withcreate_2d_density,create_annotated_heatmap,create_violin,create_scatterplotmatrixand others. SeeChanges in version 7. The documented
replacement for
create_distplotispx.histogram()with themarginalargument.Impact
univariate_densitiesis unusable on plotly 7. Anything calling it fails at runtime, socombine_distribution_plotsis affected wherever it is fed univariate densities.This is particularly awkward for projects running inside secure environments, where the
conda environment is built once by an administrator and cannot be changed by the
researcher. If the environment happened to resolve plotly 7, the function cannot be used
at all and there is no local remedy.
Suggested fix
Two parts, the first of which is worth doing regardless:
plotly>=6.6,<7until the call is migrated.px.histogram(..., marginal=...)is thedocumented path. Note that
create_distplot'sshow_hist/show_curve/show_rugswitches do not map one-to-one, so the replacement is an API decisionrather than a drop-in substitution — in particular whether the KDE curve stays
available on its own, without a histogram.
A regression test that imports and calls
univariate_densitieswould have caught this;there does not appear to be one exercising the plotting path against the installed
plotly.
Related
The rug option is worth a thought while this is being reworked:
show_rug=Trueplacesone marker per observation in the figure, which is individual-level data. Projects
working under statistical disclosure rules cannot release such a figure. Not a bug, but
relevant to whichever replacement API is chosen, and related to #98.