Fixing "warning: GMP or MPIR library not found; Not building Crypto.PublickKey._fastmath" error on Python 2.7 with CentOS 6.4

user269334 picture user269334 · Jun 26, 2013 · Viewed 44.6k times · Source

I'm running a CentOS 6.4 server with Python 2.7 (installed via PythonBrew script)

I have gmp installed via 'yum install gmp' and python-devel installed via 'yum install python-devel' (but it's for python 2.6 series)

I'm trying to install pycrypto on my server, but it's giving me

warning: GMP or MPIR library not found; Not building Crypto.PublickKey._fastmath

Is there any way to make pip 'recognize' my gmp installation?

Thanks : D

Answer

Joe J picture Joe J · Mar 13, 2014

I got the above error when trying to install Fabric at the system level on Centos 6.4 using pip. (Fabric uses pycrypto).

warning: GMP or MPIR library not found; Not building Crypto.PublickKey._fastmath

This is how I got it working:

yum install gmp-devel
sudo pip uninstall ecdsa pycrypto paramiko fabric 
# clear out the pip build dirs
rm -rf /tmp/pip-*
# make sure the directory containing libgmp.so.3 is on the python path
export LD_LIBRARY_PATH="/usr/lib64:$LD_LIBRARY_PATH"  
pip install fabric