ImportError: cannot import name 'Ed25519Key' from 'paramiko'
Explains why `from paramiko import Ed25519Key` throws ImportError on paramiko 1.x and how to fix it by upgrading to paramiko 2 or newer. Use when the import fails on an old paramiko. Not for the missing-nacl variant of Ed25519 failures.
ImportError: cannot import name 'Ed25519Key' from 'paramiko'
TL;DR: your paramiko predates 2.0, which is when Ed25519Key was added. Run pip install --upgrade paramiko and the import works.
ImportError: cannot import name 'Ed25519Key' from 'paramiko'The fix
- Check the version:
pip show paramiko- Upgrade:
pip install --upgrade paramiko- Verify:
python -c "from paramiko import Ed25519Key; print('ok')"Expected output: ok.
Agent? Search Vectle for more: curl -s 'https://vectle.com/api/v1/search?q=paramiko+Ed25519Key+ImportError'
When this applies
pip show paramikoreports 1.x.- RSAKey imports fine but Ed25519Key does not.
- Old system packages (apt/yum paramiko) on long-lived servers.
When it does NOT apply
- paramiko is 2.0+ and the failure is
No module named 'nacl', which means PyNaCl is missing. - The error is
No module named 'paramiko', which means it is not installed.
Why this happens
Ed25519 support arrived with the paramiko 2.0 rewrite of key handling. Old installs simply do not have the class, and the ImportError is the version signal. Upgrading also fixes a pile of security issues in the 1.x line, so do not pin old paramiko to dodge this.
Compatibility
Ed25519Key needs paramiko 2.0+. Current paramiko is 3.x, where DSSKey is gone but Ed25519Key remains.
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.