I have issues installing pycrypto (and thus fabric) with pip

Nicholas Kolatsis nkolatsis at gmail.com
Mon Jan 28 10:21:37 EST 2013


I'm not sure this is the right place for this but I'm don't know where else to put this.

I want to give fabric a try (as recommended here: http://www.jeffknupp.com/blog/2012/10/24/starting-a-django-14-project-the-right-way/). Installing fabric results in two dependencies (paramiko and pycrypto) being installed as well. All is dandy until it is time to install pycrypto.

A bit of searching reveals this in the documentation:

Package tools

We strongly recommend using pip to install Fabric as it is newer and generally better than easy_install. However, a combination of bugs in specific versions of Python, pip and PyCrypto can prevent installation of PyCrypto. Specifically:

    Python = 2.5.x
    PyCrypto >= 2.1 (which is required to run Fabric >= 1.3)
    pip < 0.8.1

When all three criteria are met, you may encounter No such file or directory IOErrors when trying to pip install Fabric or pip install PyCrypto.

The fix is simply to make sure at least one of the above criteria is not met, by doing the following (in order of preference):

    Upgrade to pip 0.8.1 or above, e.g. by running pip install -U pip.
    Upgrade to Python 2.6 or above.
    Downgrade to Fabric 1.2.x, which does not require PyCrypto >= 2.1, and install PyCrypto 2.0.1 (the oldest version on PyPI which works with Fabric 1.2.)


(dp130128)cheeky at n5110:~/proj/dp130128$ yolk -l
Django          - 1.4.3        - active 
Python          - 2.7.3        - active development (/usr/lib/python2.7/lib-dynload) <--check
South           - 0.7.6        - active 
argparse        - 1.2.1        - active development (/usr/lib/python2.7)
pip             - 1.2.1        - active  <--check
setuptools      - 0.6c11       - active 
wsgiref         - 0.1.2        - active development (/usr/lib/python2.7)
yolk            - 0.4.3        - active 

I've got pip and python covered above but I'm still unable to install fabric as shown below.

(dp130128)cheeky at n5110:~/proj/dp130128$ pip install fabric
Downloading/unpacking fabric
  Running setup.py egg_info for package fabric
    
    warning: no previously-included files matching '*' found under directory 'docs/_build'
    warning: no previously-included files matching '*.pyc' found under directory 'tests'
    warning: no previously-included files matching '*.pyo' found under directory 'tests'
Downloading/unpacking paramiko>=1.9.0 (from fabric)
  Running setup.py egg_info for package paramiko
    
Downloading/unpacking pycrypto>=2.1,!=2.4 (from paramiko>=1.9.0->fabric)
  Running setup.py egg_info for package pycrypto
    
Installing collected packages: fabric, paramiko, pycrypto
  Running setup.py install for fabric
    
    warning: no previously-included files matching '*' found under directory 'docs/_build'
    warning: no previously-included files matching '*.pyc' found under directory 'tests'
    warning: no previously-included files matching '*.pyo' found under directory 'tests'
    Installing fab script to /home/cheeky/.virtualenvs/dp130128/bin
  Running setup.py install for paramiko
    
  Running setup.py install for pycrypto
    warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
    building 'Crypto.Hash._MD2' extension
    gcc -pthread -fno-strict-aliasing -fwrapv -Wall -Wstrict-prototypes -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python2.7 -c src/MD2.c -o build/temp.linux-i686-2.7/src/MD2.o
    src/MD2.c:31:20: fatal error: Python.h: No such file or directory
    compilation terminated.
    error: command 'gcc' failed with exit status 1
    Complete output from command /home/cheeky/.virtualenvs/dp130128/bin/python -c "import setuptools;__file__='/home/cheeky/.virtualenvs/dp130128/build/pycrypto/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-0X00No-record/install-record.txt --single-version-externally-managed --install-headers /home/cheeky/.virtualenvs/dp130128/include/site/python2.7:
    running install

running build

running build_py

running build_ext

running build_configure

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

building 'Crypto.Hash._MD2' extension

gcc -pthread -fno-strict-aliasing -fwrapv -Wall -Wstrict-prototypes -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python2.7 -c src/MD2.c -o build/temp.linux-i686-2.7/src/MD2.o

src/MD2.c:31:20: fatal error: Python.h: No such file or directory

compilation terminated.

error: command 'gcc' failed with exit status 1

----------------------------------------
Command /home/cheeky/.virtualenvs/dp130128/bin/python -c "import setuptools;__file__='/home/cheeky/.virtualenvs/dp130128/build/pycrypto/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-0X00No-record/install-record.txt --single-version-externally-managed --install-headers /home/cheeky/.virtualenvs/dp130128/include/site/python2.7 failed with error code 1 in /home/cheeky/.virtualenvs/dp130128/build/pycrypto
Storing complete log in /home/cheeky/.pip/pip.log



More information about the Python-list mailing list