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:
Which gives the following output:
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