Plotly.py: Merely importing plotly 3.6.0 causes error

Created on 2 Feb 2019  路  5Comments  路  Source: plotly/plotly.py

I've got an issue with plotly version 3.6.0

Running import plotly gives me the following error in Spyder 3.2.4:

Traceback (most recent call last):

  File "<ipython-input-13-5fb02038c35f>", line 1, in <module>
    import plotly

  File "C:\Users\Artemis\Anaconda3\lib\site-packages\plotly\__init__.py", line 31, in <module>
    from plotly import (plotly, dashboard_objs, graph_objs, grid_objs, tools,

  File "C:\Users\Artemis\Anaconda3\lib\site-packages\plotly\plotly\__init__.py", line 10, in <module>
    from . plotly import (

  File "C:\Users\Artemis\Anaconda3\lib\site-packages\plotly\plotly\plotly.py", line 35, in <module>
    from plotly.graph_objs import Scatter

  File "C:\Users\Artemis\Anaconda3\lib\site-packages\plotly\graph_objs\__init__.py", line 82, in <module>
    from ._figurewidget import FigureWidget

  File "C:\Users\Artemis\Anaconda3\lib\site-packages\plotly\graph_objs\_figurewidget.py", line 12, in <module>
    class FigureWidget(BaseFigureWidget):

TypeError: function() argument 1 must be code, not str

Traceback (most recent call last):

  File "<ipython-input-13-5fb02038c35f>", line 1, in <module>
    import plotly

  File "C:\Users\Artemis\Anaconda3\lib\site-packages\plotly\__init__.py", line 31, in <module>
    from plotly import (plotly, dashboard_objs, graph_objs, grid_objs, tools,

  File "C:\Users\Artemis\Anaconda3\lib\site-packages\plotly\plotly\__init__.py", line 10, in <module>
    from . plotly import (

  File "C:\Users\Artemis\Anaconda3\lib\site-packages\plotly\plotly\plotly.py", line 35, in <module>
    from plotly.graph_objs import Scatter

  File "C:\Users\Artemis\Anaconda3\lib\site-packages\plotly\graph_objs\__init__.py", line 82, in <module>
    from ._figurewidget import FigureWidget

  File "C:\Users\Artemis\Anaconda3\lib\site-packages\plotly\graph_objs\_figurewidget.py", line 12, in <module>
    class FigureWidget(BaseFigureWidget):

TypeError: function() argument 1 must be code, not str
bug

Most helpful comment

Sorry for the delay - was away from computer. My version is Python 3.5.5 | packaged by conda-forge | (default, Jul 24 2018, 01:52:17) [MSC v.1900 64 bit (AMD64)] and ipywidgets 4.1.1

I downgraded to plotly 3.4.2 (since that was what your documentation was using) and that solved the problem. Thanks guys!

All 5 comments

Hi @zeluspudding,

Thanks for the report! Unfortunately I can't reproduce this. Could you include the versions of python and ipywidgets that you have installed? My suspicion is that it might have something to do with https://github.com/plotly/plotly.py/pull/1417.

Thanks!

I'm having the same problem as @zeluspudding, attempting to import plotly in a Zeppelin notebook and getting the exact same error.

I'm running Python 3.6.1 and ipywidgets 6.0.0

Thanks for the info @chornbaker.

Could you please either uninstall ipywidgets, or upgrade to ipywidgets >= 7.2 and let us know if that takes care of the problem? Thanks!

Closed on the assumption that this is a problem with having ipywidgets v6 installed, which has been taken care of in #1425.

Please comment if removing ipywidgets or upgrading to v7 doesn't fix the problem for you.

Sorry for the delay - was away from computer. My version is Python 3.5.5 | packaged by conda-forge | (default, Jul 24 2018, 01:52:17) [MSC v.1900 64 bit (AMD64)] and ipywidgets 4.1.1

I downgraded to plotly 3.4.2 (since that was what your documentation was using) and that solved the problem. Thanks guys!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

keithjjones picture keithjjones  路  3Comments

EmilienDupont picture EmilienDupont  路  4Comments

jonmmease picture jonmmease  路  3Comments

ivirshup picture ivirshup  路  3Comments

suciokhan picture suciokhan  路  3Comments