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

N

Nicholas Kolatsis

I'm not sure this is the right place for this but I'm don't know where elseto 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 aswell. 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@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@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
 
K

Kwpolska

I'm not sure this is the right place for this

It is
but I'm don't know where else to put this.

Here. (s/I’m/I/)
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.

Note that Fabric is useful for much, MUCH more than this.
(dp130128)cheeky@n5110:~/proj/dp130128$ pip install fabric

Off-topic: why is your virtualenv/project name so weird?
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

Seems to be properly installed.
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 -csrc/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

Here comes your problem: you do not have the Python header files,
required to compile the C code used by pycrypto (for speed in certain
operations, because they are quite resource-intensive). Where can you
get them? I don’t know, ask your distro. They are usually in a
package ending with -dev or -devel (depending on your distro; human
distros do not bother with this and ship them along with the rest of
the thing…)
 
N

Nicholas Kolatsis

Thanks. I've gotten everything working now.

For anyone else who comes along, 'sudo apt-get install python-dev' did the job.
Note that Fabric is useful for much, MUCH more than this.

I look forward to finding out :)
Off-topic: why is your virtualenv/project name so weird?

Noted. It's the naming pattern that I use for my projects. I should use something better but I'm using this because I usually restart something several times before I'm happy with it. I was reading up on branching with git earlier. It looks like that will put an end to this bad practice.
 
N

Nicholas Kolatsis

Thanks. I've gotten everything working now.

For anyone else who comes along, 'sudo apt-get install python-dev' did the job.
Note that Fabric is useful for much, MUCH more than this.

I look forward to finding out :)
Off-topic: why is your virtualenv/project name so weird?

Noted. It's the naming pattern that I use for my projects. I should use something better but I'm using this because I usually restart something several times before I'm happy with it. I was reading up on branching with git earlier. It looks like that will put an end to this bad practice.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,705
Latest member
Stefkari24

Latest Threads

Top