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

**URL:** <https://community.plotly.com/t/failure-at-the-first-hurdle-python-error-on-import-plotly/3331>\
**Category:** 📊 Plotly Python\
**Created:** [February 10, 2017, 4:24pm UTC](https://community.plotly.com/t/failure-at-the-first-hurdle-python-error-on-import-plotly/3331 "2017-02-10T16:24:36Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![thwill](https://avatars.discourse-cdn.com/v4/letter/t/6de8d8/32.png) [@thwill](https://community.plotly.com/u/thwill)\
**Post date:** [February 10, 2017, 4:24pm UTC](https://community.plotly.com/t/failure-at-the-first-hurdle-python-error-on-import-plotly/3331/1 "2017-02-10T16:24:36Z")

</div>

Hi there,

I’ve just started trying to use Plotly (and I’m a bit of a Python novice) following the instructions here: [https://plot.ly/python/getting-started/](https://plot.ly/python/getting-started/)

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

```
import plotly
from plotly.graph_objs import Scatter, Layout

plotly.offline.plot({
    "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 plotly_test.py
Traceback (most recent call last):
  File "plotly_test.py", line 1, in <module>
    import plotly
  File "/usr/lib/python2.7/site-packages/plotly/ __init__.py", line 31, in <module>
    from plotly import (plotly, graph_objs, grid_objs, tools, utils, session,
  File "/usr/lib/python2.7/site-packages/plotly/plotly/ __init__.py", line 10, in <module>
    from . plotly import (
  File "/usr/lib/python2.7/site-packages/plotly/plotly/plotly.py", line 27, in <module>
    from plotly import exceptions, files, session, tools, utils
  File "/usr/lib/python2.7/site-packages/plotly/tools.py", line 60, in <module>
    matplotlylib = optional_imports.get_module('plotly.matplotlylib')
  File "/usr/lib/python2.7/site-packages/plotly/optional_imports.py", line 23, in get_module
    return import_module(name)
  File "/usr/lib64/python2.7/importlib/ __init__.py", line 37, in import_module
    __import__ (name)
  File "/usr/lib/python2.7/site-packages/plotly/matplotlylib/ __init__.py", line 14, in <module>
    from plotly.matplotlylib.renderer import PlotlyRenderer
  File "/usr/lib/python2.7/site-packages/plotly/matplotlylib/renderer.py", line 13, in <module>
    import plotly.graph_objs as go
  File "/usr/lib/python2.7/site-packages/plotly/graph_objs/ __init__.py", 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/graph_objs.py", line 34, in <module>
    from plotly import exceptions, graph_reference
  File "/usr/lib/python2.7/site-packages/plotly/graph_reference.py", line 232, in <module>
    @utils.memoize()
  File "/usr/lib/python2.7/site-packages/plotly/utils.py", line 492, in memoize
    return decorator(_memoize)
  File "/usr/lib/python2.7/site-packages/decorator.py", 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?

Tom

---

<div class="post-metadata">

**Author:** ![Marbulig](https://avatars.discourse-cdn.com/v4/letter/m/ecb155/32.png) [@Marbulig](https://community.plotly.com/u/Marbulig)\
**Post date:** [February 17, 2017, 10:16am UTC](https://community.plotly.com/t/failure-at-the-first-hurdle-python-error-on-import-plotly/3331/2 "2017-02-17T10:16:25Z")

</div>

What I have done is this:

import plotly.plotly as plotly

---

<div class="post-metadata">

**Author:** ![thwill](https://avatars.discourse-cdn.com/v4/letter/t/6de8d8/32.png) [@thwill](https://community.plotly.com/u/thwill)\
**Post date:** [February 17, 2017, 10:29am UTC](https://community.plotly.com/t/failure-at-the-first-hurdle-python-error-on-import-plotly/3331/3 "2017-02-17T10:29:57Z")

</div>

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 ☹

---

<div class="post-metadata">

**Author:** ![nate.travis](https://avatars.discourse-cdn.com/v4/letter/n/d6d6ee/32.png) [@nate.travis](https://community.plotly.com/u/nate.travis)\
**Post date:** [March 24, 2017, 3:28pm UTC](https://community.plotly.com/t/failure-at-the-first-hurdle-python-error-on-import-plotly/3331/4 "2017-03-24T15:28:22Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![thwill](https://avatars.discourse-cdn.com/v4/letter/t/6de8d8/32.png) [@thwill](https://community.plotly.com/u/thwill)\
**Post date:** [March 27, 2017, 9:52am UTC](https://community.plotly.com/t/failure-at-the-first-hurdle-python-error-on-import-plotly/3331/5 "2017-03-27T09:52:22Z")

</div>

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

Tom

---

<div class="post-metadata">

**Author:** ![blloyd](https://avatars.discourse-cdn.com/v4/letter/b/c0e974/32.png) [@blloyd](https://community.plotly.com/u/blloyd)\
**Post date:** [April 28, 2017, 7:09pm UTC](https://community.plotly.com/t/failure-at-the-first-hurdle-python-error-on-import-plotly/3331/6 "2017-04-28T19:09:25Z")

</div>

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:  
cryptography  
pyOpen  
pyOpenSSL  
plotly

---

<div class="post-metadata">

**Author:** ![hailey\_huong](https://avatars.discourse-cdn.com/v4/letter/h/b487fb/32.png) [@hailey\_huong](https://community.plotly.com/u/hailey_huong)\
**Post date:** [September 10, 2018, 6:11am UTC](https://community.plotly.com/t/failure-at-the-first-hurdle-python-error-on-import-plotly/3331/7 "2018-09-10T06:11:52Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![jmmease](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/jmmease/32/3706_2.png) [@jmmease](https://community.plotly.com/u/jmmease)\
**Post date:** [September 10, 2018, 10:07am UTC](https://community.plotly.com/t/failure-at-the-first-hurdle-python-error-on-import-plotly/3331/8 "2018-09-10T10:07:32Z")

</div>

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:

```python
import sys
sys.path

```

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!  
-Jon

---

<div class="post-metadata">

**Author:** ![mmsqa](https://avatars.discourse-cdn.com/v4/letter/m/df705f/32.png) [@mmsqa](https://community.plotly.com/u/mmsqa)\
**Post date:** [February 21, 2019, 4:06pm UTC](https://community.plotly.com/t/failure-at-the-first-hurdle-python-error-on-import-plotly/3331/9 "2019-02-21T16:06:50Z")

</div>

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 robo\_graph.py --\> running into below error  
Traceback (most recent call last):  
File “robo\_graph.py”, line 4, in   
from chart import create\_chart  
File “/Users//RoboReport/chart.py”, line 1, in   
import plotly  
ImportError: No module named plotly

---

<div class="post-metadata">

**Author:** ![jmmease](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/jmmease/32/3706_2.png) [@jmmease](https://community.plotly.com/u/jmmease)\
**Post date:** [February 22, 2019, 10:58am UTC](https://community.plotly.com/t/failure-at-the-first-hurdle-python-error-on-import-plotly/3331/10 "2019-02-22T10:58:52Z")

</div>

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.

-Jon
