Skip to content

Graph Objs has no attribute FigureWidget #1630

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pedroallenrevez opened this issue Jun 19, 2019 · 13 comments
Closed

Graph Objs has no attribute FigureWidget #1630

pedroallenrevez opened this issue Jun 19, 2019 · 13 comments

Comments

@pedroallenrevez
Copy link

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?

@jonmmease
Copy link
Contributor

Hi @pedroallenrevez ,

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

@nishair
Copy link

nishair commented Jul 10, 2019

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

@ned2
Copy link
Contributor

ned2 commented Jul 16, 2019

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?

@jonmmease
Copy link
Contributor

Hi @ned2 , thanks for the suggestion. We have discussed this a bit in #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.

@jayanti-prasad
Copy link

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'
**

@nicolaskruchten
Copy link
Contributor

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?

@microprediction
Copy link

No I got the error as well, using current version. Before and after installing ipywidgets.

@jayanti-prasad
Copy link

jayanti-prasad commented Nov 21, 2020

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.

@nicolaskruchten
Copy link
Contributor

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

@jayanti-prasad
Copy link

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/

@annunal
Copy link

annunal commented Dec 13, 2020

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

@jayanti-prasad
Copy link

  1. check the version of plotly you are using

import plotly
plotly.version
'4.10.0'

  1. If it is not the right one, higher than 4.10.0, uninstall with
    pip uninstall --user plotly

  2. 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

@annunal
Copy link

annunal commented Dec 13, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants