alauri
alauri

Reputation: 317

Import issue with Python six library

inside my virtualenv I have a lot of libraries that use six as dependency but paramiko and python-keystoneclient raise this import error:

ERROR:paramiko.transport:Unknown exception: cannot import name urllib_parse
ERROR:paramiko.transport:Traceback (most recent call last):
ERROR:paramiko.transport:  File "/.../lib/python2.7/site-packages/paramiko/transport.py", line 1772, in run
ERROR:paramiko.transport:    self.kex_engine.parse_next(ptype, m)
ERROR:paramiko.transport:  File "/.../lib/python2.7/site-packages/paramiko/kex_group1.py", line 75, in parse_next
ERROR:paramiko.transport:    return self._parse_kexdh_reply(m)
ERROR:paramiko.transport:  File "/.../lib/python2.7/site-packages/paramiko/kex_group1.py", line 111, in _parse_kexdh_reply
ERROR:paramiko.transport:    self.transport._verify_key(host_key, sig)
ERROR:paramiko.transport:  File "/.../lib/python2.7/site-packages/paramiko/transport.py", line 1617, in _verify_key
ERROR:paramiko.transport:    key = self._key_info[self.host_key_type](Message(host_key))
ERROR:paramiko.transport:  File "/.../lib/python2.7/site-packages/paramiko/rsakey.py", line 58, in __init__
ERROR:paramiko.transport:    ).public_key(default_backend())
ERROR:paramiko.transport:  File "/.../lib/python2.7/site-packages/cryptography/hazmat/backends/__init__.py", line 35, in default_backend
ERROR:paramiko.transport:    _default_backend = MultiBackend(_available_backends())
ERROR:paramiko.transport:  File "/.../lib/python2.7/site-packages/cryptography/hazmat/backends/__init__.py", line 22, in _available_backends
ERROR:paramiko.transport:    "cryptography.backends"
ERROR:paramiko.transport:  File "/.../lib/python2.7/site-packages/pkg_resources/__init__.py", line 2235, in resolve
ERROR:paramiko.transport:    module = __import__(self.module_name, fromlist=['__name__'], level=0)
ERROR:paramiko.transport:  File "/.../lib/python2.7/site-packages/cryptography/hazmat/backends/openssl/__init__.py", line 7, in <module>
ERROR:paramiko.transport:    from cryptography.hazmat.backends.openssl.backend import backend
ERROR:paramiko.transport:  File "/.../lib/python2.7/site-packages/cryptography/hazmat/backends/openssl/backend.py", line 15, in <module>
ERROR:paramiko.transport:    from cryptography import utils, x509
ERROR:paramiko.transport:  File "/.../lib/python2.7/site-packages/cryptography/x509/__init__.py", line 7, in <module>
ERROR:paramiko.transport:    from cryptography.x509.base import (
ERROR:paramiko.transport:  File "/.../lib/python2.7/site-packages/cryptography/x509/base.py", line 15, in <module>
ERROR:paramiko.transport:    from cryptography.x509.extensions import Extension, ExtensionType
ERROR:paramiko.transport:  File "/.../lib/python2.7/site-packages/cryptography/x509/extensions.py", line 22, in <module>
ERROR:paramiko.transport:    from cryptography.x509.general_name import GeneralName, IPAddress, OtherName
ERROR:paramiko.transport:  File "/.../lib/python2.7/site-packages/cryptography/x509/general_name.py", line 15, in <module>
ERROR:paramiko.transport:    from six.moves import urllib_parse
ERROR:paramiko.transport:ImportError: cannot import name urllib_parse

I went through internet to find a way to fix this problem without solving it.

I already tried these steps:

These are the versions of libraries:

and I got the same issue with these Python versions:

If I try

from six.moves import urllib_parse

inside a Python shell, it works correctly.

Do you have any idea? Thanks in advance!

Upvotes: 4

Views: 1071

Answers (1)

amazpyel
amazpyel

Reputation: 156

Try to downgrade paramiko to 1.16.0. It was a solution in my case. Good luck!

Upvotes: 3

Related Questions