Search code examples
pythonraspbianpycrypto

Installing pycrypto on raspbian for python 3.2.3


Im trying to crate a cryptosystem on the raspbian OS. Chose python and pycrypto because the OS comes with python 3.2.3 pre-installed. Moved the "pycrypto-2.6.1.tar.gz" to the folder where python files are located and extracted there. Suposed to build using the command "python setup.py build" and then install.

But during the build phase, keep getting the error:

"pi@raspberrypi /usr/lib/python3.2/pycrypto-2.6.1 $ python setup.py buildrunning 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-armv6l-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

"

Not able to figure out whether I am supposed to change the pathing. Could somebody give an insight in to this?


Solution

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

    The libgmp-dev package provides the necessary files to support building the optimized module here:

    apt-get install libgmp-dev
    

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

    If you search for fatal error: Python.h: No such file or directory, the very first Google result is for this StackOverflow question, which tells you that you need to install the python-dev package:

    apt-get install python-dev
    

    In general, if you are building software from source you will need the corresponding -dev package for any required libraries; these packages provide header files (foo.h) and the unversioned shared libraries necessary for linking.