12

Possible Duplicate:
PyCrypto and GMP library not found error [Mac OS 10.6.3]

I'm trying to install pycrypto on ubuntu, but it throws error

hom@PC71:~/Desktop/pycrypto-2.3$ sudo python setup.py build
running build
running build_py
running build_ext
warning: GMP 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.6 -c src/MD2.c -o build/temp.linux-i686-2.6/src/MD2.o
src/MD2.c:31: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1

I have installed python-dev tools already.

Community
  • 1
  • 1
shivg
  • 742
  • 1
  • 8
  • 28

1 Answers1

42

You are missing the Python development libraries. (Try apt-get install python-dev.)

However, unless you have a valid reason to compile pycrypto yourself, just install it via (I think) apt-get install python-crypto.

AKX
  • 152,115
  • 15
  • 115
  • 172
  • works on linux: if you have installed GMP but don't have the python dev libraries youll need to get them before you install pycrypto – Ross Nov 04 '11 at 02:18
  • 1
    "apt-get install python-crypto" worked for me on my Raspberry Pi, thank you! – armani Apr 22 '13 at 16:29
  • 2
    This solved an issue I had in the course of installing the dependencies necessary for upgrading Ansible via pip: `sudo pip install ansible --upgrade` (one of which was pycrypto) – Justin Watt Dec 16 '13 at 08:50
  • For others that come by here trying to install on python3, you need `apt-get install python3-dev` – matrixanomaly Jul 19 '15 at 22:14