Plotly.py: Graph Objs has no attribute FigureWidget

Created on 19 Jun 2019  路  12Comments  路  Source: plotly/plotly.py

import plotly.graph_objs as ago
figure_widget = getattr(go, "FigureWidget")
E   AttributeError: module 'plotly.graph_objs' has no attribute 'FigureWidget'

This is what I obtain after running tests on a Gitlab CI server.
Even though the tests run just fine locally.
Plotly versions are 3.5.0 both locally and on the server.

I tried importing plotly on an interactive ipython shell (no notebook) and the module does have FigureWidget.

Can't provide a reproducible example for gitlab CI server, so any clues on this?

question

Most helpful comment

Hi @pedroallenrevez ,

Can you doublecheck that you have ipywidgets installed in your CI environment? FigureWidget won't be available otherwise.

All 12 comments

Hi @pedroallenrevez ,

Can you doublecheck that you have ipywidgets installed in your CI environment? FigureWidget won't be available otherwise.

@jonmmease Installing ipywidgets worked for me. Thanks for commenting. Saved me hours.

I just ran into this issue and it took finding a previously closed issue on GitHub to diagnose this problem. It would be great to make this very simple fix more discoverable. Perhaps an attempt to access the FigureWidget attribute from the graph objects module when ipywidgets is not installed could throw a more specific custom exception with a hint at how to fix the problem?

Hi @ned2 , thanks for the suggestion. We have discussed this a bit in https://github.com/plotly/plotly.py/issues/1111. I'm going to close this issue in favor of that one. Feel free to chime in over there if you have more thoughts on the current situation.

Hello guys ! This is serious and must be fixed. I have spent countless hours on it and tried everything:

**>>> import plotly.graph_objects as go
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python3.8/site-packages/plotly/graph_objects.py", line 2, in
from plotly.graph_objs import *
AttributeError: module 'plotly.graph_objs' has no attribute 'FigureWidget'

import ipywidgets
ipywidgets.__version__
'5.2.3'
**

I believe this issue was resolved in the latest versions of Plotly.py ... @jayanti-prasad can you tell me which version of plotly you're using?

This is a serious bug and has to do with the way the plotly project was developed, which is very unpythonic ! I still do not understand why to have two ways (plotly.express and plotly.graph_objects) to do the same things. I still could not find how to create pi plots for my dashboard here http://covid19db.pythonanywhere.com/ although I can do everything on my local machine.

If you're still seeing this issue, please help us help you by providing the following information about your environment:

  • operating system and version you're using
  • version of Python you're using
  • version of plotly you have installed
  • version of ipywidgets you have installed
  • variant of Jupyter you are using: Jupyter Notebook, JupyterLab, Collab, VSCode etc etc

For me the issue is resolved. I cleaned the older version of plotly and everything worked. My suggestion is to make sure that you are using plotly 4.10.0 or higher.

=====
Python 3.8.0 (default, Nov 14 2019, 22:29:45)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.

import plotly
plotly.__version__
'4.10.0'

>>> import plotly.graph_objects as go

By the way I am using it for this dashboard
http://drjprasad.pythonanywhere.com/

Could please someone indicate how to get rid off this error ? The previous user says " I cleaned the older version of plotly and everything worked. My suggestion is to make sure that you are using plotly 4.10.0 or higher" . Which are the steps to make what he say ? I tried and finally I was tarped by the syste What is the way to clean the previous version and reinstall the new one ?

And why PythonAnywhere does not automatically load the latest version of this library ?

thanks

  1. check the version of plotly you are using
    >>> import plotly
    >>> plotly.__version__
    '4.10.0'
    >>>
  2. If it is not the right one, higher than 4.10.0, uninstall with
    pip uninstall --user plotly

  3. Install the newer version
    pip install plotly==4.10.0 --user

note: I assume that your pip is identified with pip3 & python is > 3.6

The above does not work.

  1. version of plotly is not provided with plotly .version but with pip.list:
    pip list | grep plotly

plotly 4.2.1

So version is not the right one

.2. giving the command indicated it does not work:
15:54 ~/covid $ pip uninstall --user plotly
Usage:
pip uninstall [options] ...
pip uninstall [options] -r ...
no such option: --user

same with pip3

  1. However installing the version 4.10 as you indicated solved the problem even without de installing the previous one

However, I still continue to not understand why the latest version pf pltply is not included by default in the system/

Thanks

Was this page helpful?
0 / 5 - 0 ratings