paramiko / paramiko

The leading native Python SSHv2 protocol library.
http://paramiko.org
GNU Lesser General Public License v2.1
9.14k stars 2k forks source link

Import issue when using paramiko: ImportError: libffi-6322464e.so.6.0.4: cannot open shared object file: No such file or directory #1401

Open mbenhalima opened 5 years ago

mbenhalima commented 5 years ago

using paramiko 2.4.2 with python 2.7.9 cffi==1.12.2 bcrypt==3.1.6 cryptography==2.6.1 on Centos 6.9

Unable to run paramiko although libffi is installed:

  File "/home/vaasdev/vaasdev_repo/dev_repo/vaas_mbenhalima_6361075965/vaas/lib/ssh.py", line 18, in <module>
    import paramiko
  File "/usr/local/lib/python2.7/site-packages/paramiko/__init__.py", line 22, in <module>
    from paramiko.transport import SecurityOptions, Transport
  File "/usr/local/lib/python2.7/site-packages/paramiko/transport.py", line 90, in <module>
    from paramiko.ed25519key import Ed25519Key
  File "/usr/local/lib/python2.7/site-packages/paramiko/ed25519key.py", line 17, in <module>
    import bcrypt
  File "/usr/local/lib/python2.7/site-packages/bcrypt/__init__.py", line 25, in <module>
    from . import _bcrypt
ImportError: libffi-6322464e.so.6.0.4: cannot open shared object file: No such file or directory

libffi is installed:

[vaasdev@rtp-vaasdev vaas]$ ls /usr/lib64/libffi*
/usr/lib64/libffi.so  /usr/lib64/libffi.so.5  /usr/lib64/libffi.so.5.0.6

/usr/lib64/libffi-3.0.5:
include
[vaasdev@

Also, '.libs.cffi.backend' appears to have the correct libffi version:

[vaasdev@rtp-vaasdev vaas]$ ls /usr/local/lib/python2.7/site-packages/.libs_cffi_backend/
libffi-6322464e.so.6.0.4
mbenhalima commented 5 years ago

dowgrading to paramiko==1.17.0 works around this issue, but if there is a way this could be fixed in paramiko 2.4.x that will be great in order for us to use the latest paramiko updates.

pip2.7 install paramiko==1.17.0 pip2.7 install cryptography==2.6.1

NOTE: i mainly choose version 1.17.0, as it is the last paramiko version that does not have the libffi dependency

reaperhulk commented 5 years ago

Can you replicate this problem in a fresh virtualenv? Generally import issues like this are indicative of some sort of issue in the python path. If you create an empty virtualenv and have no issues installing the packages then the problem is likely to be with your environment.

codek commented 4 years ago

I also have this problem. I'm deploying it to lambda. In a venv it works fine. but in lambda it fails. Downgrading to 1.17.0 also fixes it for me!

lucasfrr commented 4 years ago

Hi,

I had the same problem with jupyter when I ran jupyter notebook or jupyter lab command. In my case, I installed a package called libffi6. The site SourcePython recommends installing libffi6 and another one called zlib but zlib already been installed on my OS. After installations the problem was fixed.