ImportError: libffi.so.6: cannot open shared object file: No such file or directory


When installing a python module, if you see similar error like ImportError: libffi.so.6: cannot open shared object file: No such file or directory 

—————————————-
Command “/usr/local/bin/python2.7 -c “import setuptools, tokenize;__file__=’/tmp/pip-build-RZWd8I/cryptography/setup.py’;exec(compile(getattr(tokenize, ‘open’, open)(__file__).read().replace(‘\r\n’, ‘\n’), __file__, ‘exec’))” install –record /tmp/pip-nle_4p-record/install-record.txt –single-version-externally-managed –compile” failed with error code 1 in /tmp/pip-build-RZWd8I/cryptography

It is normally caused by that the file location is not in the python sys.path. The fix is to add this file path to environmental variable LD_LIBRARY_PATH

Example:

[root@myserver ~]# find / -name libffi.so.6
/usr/local/lib64/libffi.so.6
/root/libffi-3.2.1/x86_64-unknown-linux-gnu/.libs/libffi.so.6

[root@myserver~]# echo $LD_LIBRARY_PATH

[root@myserver ~]# export LD_LIBRARY_PATH=”/usr/local/lib64/”

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s