question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Figure factory broken in release 4.7.0

See original GitHub issue

Describe the bug

Related to https://github.com/plotly/plotly.py/issues/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)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
nicolaskruchtencommented, Jan 3, 2022

@leo-smi this is intentional, yes.

1reaction
jonmmeasecommented, May 7, 2020

Proposed fix in https://github.com/plotly/plotly.py/pull/2445. @emmanuelle would you have time to take a look?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Introducing plotly.py 4.0.0 - Plotly Community Forum
Introducing plotly.py 4.0.0rc1. I'm happy to announce the availability of the first release candidate of plotly.py version 4.
Read more >
python-plotly-4.7.1-bp152.1.1 - SUSE Package Hub -
0 This release introduces the long-anticipated ability to programmatically export figures as high quality static images in both raster and vector formats. + ......
Read more >
mayavi 4.8.1 documentation - Enthought Tool Suite
Mayavi 4.7.​​ This is a small bug fix release mainly concerned with compatability with Traits 6.2. 0 and soon to be release TraitsUI...
Read more >
Changelog - TinyMCE
... fixed a bug in the image plugin that caused updating figures to split contenteditable elements. fixed a bug that was ... Version...
Read more >
Changelog — Hypothesis 6.60.0 documentation
This has been broken since Pytest 5.4, which changed the internal API for adding ... This release deprecates use of both min_dims >...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found