Nicox11 Nicox11 - 1 year ago 208
Python Question

Can't install module python pip

i'm new to python. I'd like to use pysnmp module, so i tried to install it with pip but i'm getting errors from it :

Failed building wheel for pycrypto

I tried on multiple system (Ubuntu, Debian and RH) and I always get the same error. How can i install pysnmp ? Or are there any other alternative to work with snmp with python ?

Shell Command :

sudo -H pip install pysnmp

Result :

configure: creating ./config.status
config.status: creating src/config.h
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastm ath.
building 'Crypto.Hash._MD2' extension
creating build/temp.linux-x86_64-3.4
creating build/temp.linux-x86_64-3.4/src
x86_64-linux-gnu-gcc -pthread -fwrapv -Wall -Wstrict-prototypes -fstack-prot ector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOUR CE=2 -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python3.4m -c src/MD2.c -o build/temp.linux-x86_64-3.4/src/MD2.o
src/MD2.c:31:20: fatal error: Python.h: No such file or directory
#include "Python.h"
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip- build-7gwchpkq/pycrypto/';exec(compile(getattr(tokenize, 'open', open)(_ _file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp /pip-6mlabkyq-record/install-record.txt --single-version-externally-managed --co mpile" failed with error code 1 in /tmp/pip-build-7gwchpkq/pycrypto/

Answer Source

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

The actual error is that you do not have the dev files for python language (python.h not found).

So, install python-dev:

sudo apt-get install  python-dev
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download