Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

Cannot import plotly can anyone help me understand that?

Hi there forlks, just installed plotly python on Ubuntu 15.10

i’ve installed numpy and of course installed plotly via pip
my current plotly version is 1.12.9 , if I print on screen pip show plotly. The problem is that when I try to import plotly via python i gets this error:


import plotly
Traceback (most recent call last):
File “”, line 1, in
File “/usr/local/lib/python2.7/dist-packages/plotly/”, line 31, in
from plotly import (plotly, graph_objs, grid_objs, tools, utils, session,
File “/usr/local/lib/python2.7/dist-packages/plotly/plotly/”, line 10, in
from . plotly import (
File “/usr/local/lib/python2.7/dist-packages/plotly/plotly/”, line 31, in
from plotly import exceptions, tools, utils, version, files
File “/usr/local/lib/python2.7/dist-packages/plotly/”, line 21, in
from plotly import graph_reference
File “/usr/local/lib/python2.7/dist-packages/plotly/”, line 518, in
GRAPH_REFERENCE = get_graph_reference()
File “/usr/local/lib/python2.7/dist-packages/plotly/”, line 93, in get_graph_reference
File “/home/domenico/.local/lib/python2.7/site-packages/requests/”, line 70, in get
return request(‘get’, url, params=params, **kwargs)
File “/home/domenico/.local/lib/python2.7/site-packages/requests/”, line 56, in request
return session.request(method=method, url=url, **kwargs)
File “/home/domenico/.local/lib/python2.7/site-packages/requests/”, line 488, in request
resp = self.send(prep, **send_kwargs)
File “/home/domenico/.local/lib/python2.7/site-packages/requests/”, line 609, in send
r = adapter.send(request, **kwargs)
File “/home/domenico/.local/lib/python2.7/site-packages/requests/”, line 423, in send
File “/home/domenico/.local/lib/python2.7/site-packages/requests/packages/urllib3/”, line 594, in urlopen
File “/home/domenico/.local/lib/python2.7/site-packages/requests/packages/urllib3/”, line 350, in _make_request
File “/home/domenico/.local/lib/python2.7/site-packages/requests/packages/urllib3/”, line 835, in _validate_conn
File “/home/domenico/.local/lib/python2.7/site-packages/requests/packages/urllib3/”, line 330, in connect
cert = self.sock.getpeercert()
File “/home/domenico/.local/lib/python2.7/site-packages/requests/packages/urllib3/contrib/”, line 324, in getpeercert
’subjectAltName’: get_subj_alt_name(x509)
File “/home/domenico/.local/lib/python2.7/site-packages/requests/packages/urllib3/contrib/”, line 171, in get_subj_alt_name
ext = cert.extensions.get_extension_for_class(
AttributeError: ‘Extensions’ object has no attribute ‘get_extension_for_class’

Someone has any idea what is going on? Just can get out of this !! I even cannot log in with my API key!

Seems to have resolved the issuee after hours of head hacheee!!
The problem was in a file .local/lib/python2.7/site-packages/requests/packages/urllib3/contrib/
i changed permission to all the folder, and change the line 171 in the file, substituting extension with Extensions
now seems to import plotly, i’ll tell you if it is gonna work! :slight_smile:

Nope… this seems not to work!! Why it has just worked feww minutes ago, and now is not going!! :S

Finally maneged to resolve completely the issue.
The problem was with the python module cryptography, which was not updated.

just typed:

sudo pip install cryptography --update

and worked! :smiley: