Import error when starting to use plotly

17,088

I had a similar error and following Mark's note above, pip install --upgrade plotly worked for me.

Share:
17,088
Mark Horvath
Author by

Mark Horvath

Updated on June 27, 2022

Comments

  • Mark Horvath
    Mark Horvath almost 2 years

    I'm trying to use plotly, based on the tutorial here: http://nbviewer.ipython.org/github/plotly/python-user-guide/blob/master/s00_homepage/s00_homepage.ipynb

    Seem to have the correct library and Python versions, although I get AttributeError while importing plotly. Wonder if anyone had the same problem, see versions and stacktrace below:

    Python 2.7.5+ (default, Feb 27 2014, 19:37:08) 
    Type "copyright", "credits" or "license" for more information.
    
    IPython 2.0.0 -- An enhanced Interactive Python.
    ?         -> Introduction and overview of IPython's features.
    %quickref -> Quick reference.
    help      -> Python's own help system.
    object?   -> Details about 'object', use 'object??' for extra details.
    
    In [1]: import numpy
    
    In [2]: numpy.__version__
    Out[2]: '1.8.1'
    
    In [3]: import pandas
    
    In [4]: pandas.__version__
    Out[4]: '0.13.1'
    
    In [5]: import plotly
    ---------------------------------------------------------------------------
    AttributeError                            Traceback (most recent call last)
    <ipython-input-5-c27a4132ad2e> in <module>()
    ----> 1 import plotly
    
    /usr/local/lib/python2.7/dist-packages/plotly/__init__.py in <module>()
         29 from __future__ import absolute_import
         30 
    ---> 31 from plotly import plotly, graph_objs, tools, utils
         32 from plotly.version import __version__
    
    /usr/local/lib/python2.7/dist-packages/plotly/plotly/__init__.py in <module>()
         10 from __future__ import absolute_import
         11 
    ---> 12 from plotly.plotly.plotly import *
         13 
         14 __all__ = ["sign_in", "update_plot_options", "get_plot_options",
    
    /usr/local/lib/python2.7/dist-packages/plotly/plotly/plotly.py in <module>()
         27 from plotly.plotly import chunked_requests
         28 from plotly import utils
    ---> 29 from plotly import tools
         30 from plotly import exceptions
         31 from plotly import version
    
    /usr/local/lib/python2.7/dist-packages/plotly/tools.py in <module>()
         18 from plotly import exceptions
         19 
    ---> 20 from . graph_objs import graph_objs
         21 
         22 # Warning format
    
    /usr/local/lib/python2.7/dist-packages/plotly/graph_objs/__init__.py in <module>()
         10 from __future__ import absolute_import
         11 
    ---> 12 from plotly.graph_objs.graph_objs import *
         13 
         14 __all__ = ["Data",
    
    /usr/local/lib/python2.7/dist-packages/plotly/graph_objs/graph_objs.py in <module>()
        279         return super(DictMeta, mcs).__new__(mcs, name, bases, attrs)
        280 
    --> 281 @six.add_metaclass(ListMeta)
        282 class PlotlyList(list):
        283     """A container for PlotlyDicts, inherits from standard list.
    
    AttributeError: 'module' object has no attribute 'add_metaclass'