Failure at the first hurdle - Python error on "import plotly"

Hi there,

I’ve just started trying to use Plotly (and I’m a bit of a Python novice) following the instructions here:

No errors were reported during installation, but when I try the example:

import plotly
from plotly.graph_objs import Scatter, Layout

    "data": [Scatter(x=[1, 2, 3, 4], y=[4, 3, 2, 1])],
    "layout": Layout(title="hello world")

I get the error:

[thwill@pseuk1149-centos7-vm]$ python
Traceback (most recent call last):
  File "", line 1, in <module>
    import plotly
  File "/usr/lib/python2.7/site-packages/plotly/", line 31, in <module>
    from plotly import (plotly, graph_objs, grid_objs, tools, utils, session,
  File "/usr/lib/python2.7/site-packages/plotly/plotly/", line 10, in <module>
    from . plotly import (
  File "/usr/lib/python2.7/site-packages/plotly/plotly/", line 27, in <module>
    from plotly import exceptions, files, session, tools, utils
  File "/usr/lib/python2.7/site-packages/plotly/", line 60, in <module>
    matplotlylib = optional_imports.get_module('plotly.matplotlylib')
  File "/usr/lib/python2.7/site-packages/plotly/", line 23, in get_module
    return import_module(name)
  File "/usr/lib64/python2.7/importlib/", line 37, in import_module
  File "/usr/lib/python2.7/site-packages/plotly/matplotlylib/", line 14, in <module>
    from plotly.matplotlylib.renderer import PlotlyRenderer
  File "/usr/lib/python2.7/site-packages/plotly/matplotlylib/", line 13, in <module>
    import plotly.graph_objs as go
  File "/usr/lib/python2.7/site-packages/plotly/graph_objs/", line 14, in <module>
    from plotly.graph_objs.graph_objs import *  # this is protected with __all__
  File "/usr/lib/python2.7/site-packages/plotly/graph_objs/", line 34, in <module>
    from plotly import exceptions, graph_reference
  File "/usr/lib/python2.7/site-packages/plotly/", line 232, in <module>
  File "/usr/lib/python2.7/site-packages/plotly/", line 492, in memoize
    return decorator(_memoize)
  File "/usr/lib/python2.7/site-packages/", line 213, in decorator
    fun = getfullargspec(callerfunc).args[0] # first arg
IndexError: list index out of range

Using Python 2.7.5 on CentOS 7.

Can anyone help?


What I have done is this:

import plotly.plotly as plotly

I don’t think that was the problem.

In then end I randomly installed/uninstalled/upgraded various bits of python and generally hit things with a hammer until I got it working … not an explanation that really helps anyone else :frowning:

Hey thwill - I’m running into this error too, and it’s driving me crazy. You ever get any more clues as to what might have been the problem - or at least which packages to upgrade?

Sorry, like I say I messed about a bit, lost interest, then returned and found it was working :wink:


In case anyone needs this info, I found a solution to this issue as such:
Update pip, then use pip to upgrade the following packages in this order:

I upgraded plotly and I have this issue as well. I was be able to import plotly through my Mac terminal, but encountered error in my Jupyter Notebook. ModuleNotFoundError: No module named ‘plotly’ It has driven me crazy. Any help please?

Hi @hailey_huong,

It’s hard to say for sure, but this can happen if you’re using virtual environments or conda environments and you have the jupyter notebook installed in a separate environment from plotly.

Something else you can try. Run this to display all of the directories where python is searching for modules:

import sys

Do this in ipython and in the notebook and see if the paths are different, and if that gives you any clues.

Hope that helps!

1 Like

Anyone found out what is going on? i have same issue with plotly.
i have plotly version 3.6.1, python 2.7.4. trying to run --> python --> running into below error
Traceback (most recent call last):
File “”, line 4, in
from chart import create_chart
File “/Users//RoboReport/”, line 1, in
import plotly
ImportError: No module named plotly

Hi @mmsqa ,

Could you check the output of pip list and conda list (if you have conda installed)? First thing I would try is uninstalling it using both, and then install again using either pip or conda.