I have installed the paramiko module. However, when I tried to import that module. I got the following error.
import paramiko
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-42-e77d47aa6e4a> in <module>()
----> 1 import paramiko
C:\Anaconda\lib\site-packages\paramiko\__init__.py in <module>()
28
29
---> 30 from paramiko.transport import SecurityOptions, Transport
31 from paramiko.client import SSHClient, MissingHostKeyPolicy, AutoAddPolicy, RejectPolicy, WarningPolicy
32 from paramiko.auth_handler import AuthHandler
C:\Anaconda\lib\site-packages\paramiko\transport.py in <module>()
30
31 import paramiko
---> 32 from paramiko import util
33 from paramiko.auth_handler import AuthHandler
34 from paramiko.ssh_gss import GSSAuth
ImportError: cannot import name util
Does anyone know how to resolve this issue?
I have just had the same issue myself (python 2.7.6), and ran into this answer here ImportError: Cannot import name X , which was referred in the question's comments, suggesting it's a circular dependency issue.
After not finding any elegant solution I found myself editing paramiko's source code in site-packages/paramiko/transport.py
:
from paramiko import util
util
(in this file) to paramiko.util
paramiko.util
This had fixed the problem for me, leaving me somewhat confused: on the one hand, modifying the import method seems to solve this, but on the other hand Python deals with it in like... 99% of the cases..? Awkward.