Import error in algorithms.py with 3.6.1
timrichardson opened this issue · 2 comments
timrichardson commented
I have python 3.6.1. and jwt 0.5.1
I'm getting an import error. I don't know why.
File "/usr/local/lib/python3.6/dist-packages/requests/api.py", line 72, in get
return request('get', url, params=params, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/requests/api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/requests/sessions.py", line 504, in request
prep = self.prepare_request(req)
File "/usr/local/lib/python3.6/dist-packages/requests/sessions.py", line 436, in prepare_request
hooks=merge_hooks(request.hooks, self.hooks),
File "/usr/local/lib/python3.6/dist-packages/requests/models.py", line 306, in prepare
self.prepare_auth(auth, url)
File "/usr/local/lib/python3.6/dist-packages/requests/models.py", line 543, in prepare_auth
r = auth(self)
File "/usr/local/lib/python3.6/dist-packages/requests_oauthlib/oauth1_auth.py", line 88, in __call__
unicode(r.url), unicode(r.method), None, r.headers)
File "/usr/local/lib/python3.6/dist-packages/oauthlib/oauth1/rfc5849/__init__.py", line 314, in sign
('oauth_signature', self.get_oauth_signature(request)))
File "/usr/local/lib/python3.6/dist-packages/oauthlib/oauth1/rfc5849/__init__.py", line 151, in get_oauth_signature
sig = self.SIGNATURE_METHODS[self.signature_method](base_string, self)
File "/usr/local/lib/python3.6/dist-packages/oauthlib/oauth1/rfc5849/signature.py", line 505, in sign_rsa_sha1_with_client
return sign_rsa_sha1(base_string, client.rsa_key)
File "/usr/local/lib/python3.6/dist-packages/oauthlib/oauth1/rfc5849/signature.py", line 496, in sign_rsa_sha1
alg = _jwt_rs1_signing_algorithm()
File "/usr/local/lib/python3.6/dist-packages/oauthlib/oauth1/rfc5849/signature.py", line 473, in _jwt_rs1_signing_algorithm
import jwt.algorithms as jwtalgo
File "/usr/local/lib/python3.6/dist-packages/jwt/algorithms.py", line 5, in <module>
from .exceptions import InvalidKeyError
ImportError: cannot import name 'InvalidKeyError'
yosida95 commented
This problem seems to be not of GehirnInc/jwt but of jpadilla/pyjwt.
According to the trace back you pasted above, jwt
which was imported byoauthlib
raised ImportError exception. oauthlib
does not depend on my jwt
package, it depends on jpadilla/pyjwt instead. https://github.com/idan/oauthlib/blob/91152df142bdde134d84ed27963cda8e6b878416/setup.py#L20-L23
Would you provide a list of packages you've installed with pip freeze
?
JoaquinChartier commented
I have solved this problem uninstalling "jwt" package and reinstalling "pyjwt" package. Both have the same name. Thanks @yosida95