Search code examples
pythonpipparamikolibffi

Can not install Paramiko in Cent OS


Recently I am trying to learn python and write some scripts during work. However I found my python is not update to date. So I upgrade from 2.6 to 2.7.6 following some guide from network. After that the python, pip and easy_install seems all okay. Then I tried to install Paramiko using pip. The error show the libffi not found as below. However when I tried to install libffi, it shows already there. I tried to search if any other packages there, but there is no.

The problem is that pip tried to find libffi.pc but it is not in any of the package.

Could anyone give me a hand?

Thanks!


[root@vmx-dsm-038 ~]# pip install paramiko
Requirement already satisfied (use --upgrade to upgrade): paramiko in /usr/local/lib/python2.7/site-packages/paramiko-2.0.0-py2.7.egg
Collecting cryptography>=1.1 (from paramiko)
/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
  SNIMissingWarning
/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Using cached cryptography-1.4.tar.gz
Requirement already satisfied (use --upgrade to upgrade): pyasn1>=0.1.7 in /usr/local/lib/python2.7/site-packages (from paramiko)
Requirement already satisfied (use --upgrade to upgrade): idna>=2.0 in /usr/local/lib/python2.7/site-packages (from cryptography>=1.1->paramiko)
Requirement already satisfied (use --upgrade to upgrade): six>=1.4.1 in /usr/local/lib/python2.7/site-packages (from cryptography>=1.1->paramiko)
Requirement already satisfied (use --upgrade to upgrade): setuptools>=11.3 in /usr/local/lib/python2.7/site-packages/setuptools-22.0.5-py2.7.egg (from cryptography>=1.1->paramiko)
Requirement already satisfied (use --upgrade to upgrade): enum34 in /usr/local/lib/python2.7/site-packages (from cryptography>=1.1->paramiko)
Requirement already satisfied (use --upgrade to upgrade): ipaddress in /usr/local/lib/python2.7/site-packages (from cryptography>=1.1->paramiko)
Collecting cffi>=1.4.1 (from cryptography>=1.1->paramiko)
  Using cached cffi-1.6.0.tar.gz
Requirement already satisfied (use --upgrade to upgrade): pycparser in /usr/local/lib/python2.7/site-packages (from cffi>=1.4.1->cryptography>=1.1->paramiko)
Building wheels for collected packages: cryptography, cffi
  Running setup.py bdist_wheel for cryptography ... error
  Complete output from command /usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-TN9_mw/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmpQ9VyZFpip-wheel- --python-tag cp27:
  Package libffi was not found in the pkg-config search path.
  Perhaps you should add the directory containing `libffi.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'libffi' found
  Package libffi was not found in the pkg-config search path.
  Perhaps you should add the directory containing `libffi.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'libffi' found
  Package libffi was not found in the pkg-config search path.
  Perhaps you should add the directory containing `libffi.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'libffi' found
  Package libffi was not found in the pkg-config search path.
  Perhaps you should add the directory containing `libffi.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'libffi' found
  Package libffi was not found in the pkg-config search path.
  Perhaps you should add the directory containing `libffi.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'libffi' found
  c/_cffi_backend.c:15:17: error: ffi.h: No such file or directory
  In file included from c/_cffi_backend.c:63:

[root@vmx-dsm-038 ~]# yum install libffi
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Setting up Install Process
Package libffi-3.0.5-3.2.el6.x86_64 already installed and latest version
Nothing to do

[root@vmx-dsm-038 ~]# yum search libffi
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
====================================================================================== N/S Matched: libffi ======================================================================================
libffi.i686 : A portable foreign function interface library
libffi.x86_64 : A portable foreign function interface library

  Name and summary matches only, use "search all" for everything.

[root@vmx-dsm-038 ~]# rpm -ql libffi.x86_64
/usr/lib64/libffi.so.5
/usr/lib64/libffi.so.5.0.6
/usr/share/doc/libffi-3.0.5
/usr/share/doc/libffi-3.0.5/LICENSE
/usr/share/doc/libffi-3.0.5/README


[root@vmx-dsm-038 ~]# yum install libffi-devel
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Setting up Install Process
No package libffi-devel available.
Error: Nothing to do

[root@vmx-dsm-038 ~]# yum upgrade libffi-devel
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Setting up Upgrade Process
No Match for argument: libffi-devel
No package libffi-devel available.
No Packages marked for Update
[root@vmx-dsm-038 ~]# yum upgrade libffi
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Setting up Upgrade Process
No Packages marked for Update

[root@vmx-dsm-038 ~]# locate libffi
/opt/Python-2.7.6/Modules/_ctypes/libffi
/opt/Python-2.7.6/Modules/_ctypes/libffi.diff
/opt/Python-2.7.6/Modules/_ctypes/libffi_arm_wince
/opt/Python-2.7.6/Modules/_ctypes/libffi_msvc
......
/opt/Python-2.7.6/build/temp.linux-x86_64-2.7/libffi/src/xtensa/.deps/sysv.Plo
/opt/Python-2.7.6/build/temp.linux-x86_64-2.7/libffi/testsuite/Makefile
/opt/Python-2.7.6/build/temp.linux-x86_64-2.7/opt/Python-2.7.6/Modules/_ctypes/libffi
/opt/Python-2.7.6/build/temp.linux-x86_64-2.7/opt/Python-2.7.6/Modules/_ctypes/libffi/src
/opt/Python-2.7.6/build/temp.linux-x86_64-2.7/opt/Python-2.7.6/Modules/_ctypes/libffi/src/closures.o
/opt/Python-2.7.6/build/temp.linux-x86_64-2.7/opt/Python-2.7.6/Modules/_ctypes/libffi/src/prep_cif.o
/opt/Python-2.7.6/build/temp.linux-x86_64-2.7/opt/Python-2.7.6/Modules/_ctypes/libffi/src/x86
/opt/Python-2.7.6/build/temp.linux-x86_64-2.7/opt/Python-2.7.6/Modules/_ctypes/libffi/src/x86/ffi.o
/opt/Python-2.7.6/build/temp.linux-x86_64-2.7/opt/Python-2.7.6/Modules/_ctypes/libffi/src/x86/ffi64.o
/opt/Python-2.7.6/build/temp.linux-x86_64-2.7/opt/Python-2.7.6/Modules/_ctypes/libffi/src/x86/sysv.o
/opt/Python-2.7.6/build/temp.linux-x86_64-2.7/opt/Python-2.7.6/Modules/_ctypes/libffi/src/x86/unix64.o
/usr/lib64/libffi.so.5
/usr/lib64/libffi.so.5.0.6
/usr/share/doc/libffi-3.0.5
/usr/share/doc/libffi-3.0.5/LICENSE
/usr/share/doc/libffi-3.0.5/README
/var/lib/yum/yumdb/l/66af3a78b71c9ab35c98a0a9bcd1cb15d195d206-libffi-3.0.5-3.2.el6-x86_64
/var/lib/yum/yumdb/l/66af3a78b71c9ab35c98a0a9bcd1cb15d195d206-libffi-3.0.5-3.2.el6-x86_64/checksum_data
/var/lib/yum/yumdb/l/66af3a78b71c9ab35c98a0a9bcd1cb15d195d206-libffi-3.0.5-3.2.el6-x86_64/checksum_type
/var/lib/yum/yumdb/l/66af3a78b71c9ab35c98a0a9bcd1cb15d195d206-libffi-3.0.5-3.2.el6-x86_64/from_repo
/var/lib/yum/yumdb/l/66af3a78b71c9ab35c98a0a9bcd1cb15d195d206-libffi-3.0.5-3.2.el6-x86_64/from_repo_revision
/var/lib/yum/yumdb/l/66af3a78b71c9ab35c98a0a9bcd1cb15d195d206-libffi-3.0.5-3.2.el6-x86_64/from_repo_timestamp
/var/lib/yum/yumdb/l/66af3a78b71c9ab35c98a0a9bcd1cb15d195d206-libffi-3.0.5-3.2.el6-x86_64/installed_by
/var/lib/yum/yumdb/l/66af3a78b71c9ab35c98a0a9bcd1cb15d195d206-libffi-3.0.5-3.2.el6-x86_64/reason
/var/lib/yum/yumdb/l/66af3a78b71c9ab35c98a0a9bcd1cb15d195d206-libffi-3.0.5-3.2.el6-x86_64/releasever

Solution

  • I've finally found the solution for this. Thanks NepCoder! I manually download the libffi-devel from page https://pkgs.org/centos-6/centos-x86_64/libffi-devel-3.0.5-3.2.el6.x86_64.rpm.html. Then using 'rpm -ivh libffi-devel-3.0.5-3.2.el6.x86_64.rpm' to install it on my VM.

    Everything works fine after that. I guess my yum repo may have something wrong.