I was trying to sftp some files using Python Paramiko on Ubuntu 14.04 and got the following error: “paramiko.SSHException: Incompatible ssh peer (no acceptable kex algorithm)”. It turns out that there is an incompatibility issue with OpenSSH 6.7 and Paramiko with a version less than 1.15.1. At the time of writing (November 2014) Ubuntu 14.04 came with 1.10.1.
To fix the issue, you need to upgrade Paramiko to at least 1.15.1. You can do this by using PIP which is a Python package management system. Here is how to you do this:
apt-get install python-pip
Do a quick version check of the Python libs like so:
pip freeze
Which gives the following output:
landscape-Client==14.01
PAM==0.4.2
Twisted-Core==13.2.0
Twisted-Names==13.2.0
Twisted-Web==13.2.0
apt-xapian-index==0.45
argparse==1.2.1
chardet==2.0.1
colorama==0.2.5
configobj==4.7.2
html5lib==0.999
mercurial==2.8.2
paramiko==1.10.1
pyOpenSSL==0.13
pycrypto==2.6.1
pycurl==7.19.3
pyinotify==0.9.4
pyserial==2.6
python-apt==0.9.3.5
python-debian==0.1.21-nmu2ubuntu2
requests==2.2.1
six==1.5.2
ssh-import-id==3.21
urllib3==1.7.1
wsgiref==0.1.2
zope.interface==4.0.5
Then upgrade Paramiko using PIP.
pip install paramiko --upgrade
Voila. Paramiko sftp should now work.
In my case, I actually use Ansible to deploy changes across multiple servers. Ansible comes with a PIP module. You can automatically upgrade Paramiko across all servers like so:
## Python Packages Using PIP ## We are doing this because we require the latest version of paramiko - pip: name=paramiko state=latest
Thanks, works great!
Sadly, Debian patches `pip` so that it refuses to upgrade libraries “owned by the OS” so this no longer works.
I would remove the pip that Debian has clearly patched and reinstalling it using get-pip.py. That should solve you problem.
Thank you! Resolved my problem with duplicity.
This Fixed it for me on Raspberry Pi with python 2 also.
Awesome. thanks