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:

python

import plotly
Traceback (most recent call last):
File “”, line 1, in
File “/usr/local/lib/python2.7/dist-packages/plotly/init.py”, line 31, in
from plotly import (plotly, graph_objs, grid_objs, tools, utils, session,
File “/usr/local/lib/python2.7/dist-packages/plotly/plotly/init.py”, line 10, in
from . plotly import (
File “/usr/local/lib/python2.7/dist-packages/plotly/plotly/plotly.py”, line 31, in
from plotly import exceptions, tools, utils, version, files
File “/usr/local/lib/python2.7/dist-packages/plotly/tools.py”, line 21, in
from plotly import graph_reference
File “/usr/local/lib/python2.7/dist-packages/plotly/graph_reference.py”, line 518, in
GRAPH_REFERENCE = get_graph_reference()
File “/usr/local/lib/python2.7/dist-packages/plotly/graph_reference.py”, line 93, in get_graph_reference
timeout=GRAPH_REFERENCE_DOWNLOAD_TIMEOUT)
File “/home/domenico/.local/lib/python2.7/site-packages/requests/api.py”, line 70, in get
return request(‘get’, url, params=params, **kwargs)
File “/home/domenico/.local/lib/python2.7/site-packages/requests/api.py”, line 56, in request
return session.request(method=method, url=url, **kwargs)
File “/home/domenico/.local/lib/python2.7/site-packages/requests/sessions.py”, line 488, in request
resp = self.send(prep, **send_kwargs)
File “/home/domenico/.local/lib/python2.7/site-packages/requests/sessions.py”, line 609, in send
r = adapter.send(request, **kwargs)
File “/home/domenico/.local/lib/python2.7/site-packages/requests/adapters.py”, line 423, in send
timeout=timeout
File “/home/domenico/.local/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py”, line 594, in urlopen
chunked=chunked)
File “/home/domenico/.local/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py”, line 350, in _make_request
self._validate_conn(conn)
File “/home/domenico/.local/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py”, line 835, in _validate_conn
conn.connect()
File “/home/domenico/.local/lib/python2.7/site-packages/requests/packages/urllib3/connection.py”, line 330, in connect
cert = self.sock.getpeercert()
File “/home/domenico/.local/lib/python2.7/site-packages/requests/packages/urllib3/contrib/pyopenssl.py”, line 324, in getpeercert
’subjectAltName’: get_subj_alt_name(x509)
File “/home/domenico/.local/lib/python2.7/site-packages/requests/packages/urllib3/contrib/pyopenssl.py”, 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/pyopenssl.py
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:

EDIT:
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: