Skip to content

Figure factory broken in release 4.7.0 #2443

Closed
@cliffckerr

Description

@cliffckerr

Describe the bug

Related to #1111, import plotly.figure_factory fails with the most recent Plotly release (4.7) without a helpful error message.

To reproduce

First noticed with

conda create -n plotly_test python=3.7.7
conda activate plotly_test
pip install plotly_express
python
>>> import plotly.figure_factory

(which worked until this morning's release), but also reproducible via:

conda create -n plotly_test python=3.7.7
conda activate plotly_test
pip install numpy==1.18.4 plotly==4.7.0
python
>>> import plotly.figure_factory

Expected behavior

It works, or at least gives a helpful error message.

Actual behavior

>>> import plotly.figure_factory
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/software/anaconda3/envs/plotly_test/lib/python3.7/site-packages/plotly/figure_factory/__init__.py", line 14, in <module>
    from plotly.figure_factory._2d_density import create_2d_density
  File "/software/anaconda3/envs/plotly_test/lib/python3.7/site-packages/plotly/figure_factory/_2d_density.py", line 8, in <module>
    from plotly.graph_objs import graph_objs
  File "/software/anaconda3/envs/plotly_test/lib/python3.7/site-packages/plotly/graph_objs/graph_objs.py", line 1, in <module>
    from plotly.graph_objs import *
  File "/software/anaconda3/envs/plotly_test/lib/python3.7/site-packages/plotly/graph_objs/__init__.py", line 290, in __getattr__
    return orig_getattr(import_name)
  File "/software/anaconda3/envs/plotly_test/lib/python3.7/site-packages/_plotly_utils/importers.py", line 41, in __getattr__
    name=import_name, __name__=parent_name
AttributeError: module 'plotly.graph_objs' has no attribute 'FigureWidget'

Workaround

Manually install ipywidgets (e.g., pip install ipywidgets plotly_express works).

Suggested solution

Add ipywidgets back to the plotly_express requirements, and make an ipywidgets error message similar to the one that exists if you try to use figure_factory without having numpy installed.

Platform:

  • OS: Ubuntu 18.04
  • Python: 3.7.7 (observed on Python 3.8 as well, but not on Python 3.6)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsomething broken

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions