helpsystems / pcapy

Pcapy is a Python extension module that interfaces with the libpcap packet capture library.
Other
383 stars 105 forks source link

pip3 install pcapy==0.11.4 failed #58

Closed karthikdialpad closed 5 years ago

karthikdialpad commented 5 years ago

pip3 install pcapy==0.11.4 failed with "command 'x86_64-linux-gnu-gcc' failed with exit status 1"

The complete console output is below

root@rs-dal-karthik-test:/usr/local/talkiq/sniff_realtime# ./bin/pip3 install pcapy==0.11.4
Collecting pcapy==0.11.4
  Using cached https://files.pythonhosted.org/packages/b0/68/b49e008f9e2b5ab727fb4b820c2e7d0914bd8dacb3c2d668a36b6e5d8991/pcapy-0.11.4.tar.gz
Installing collected packages: pcapy
  Running setup.py install for pcapy ... error
    Complete output from command /usr/local/talkiq/sniff_realtime/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-sdr47lrh/pcapy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-dae79fry/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/talkiq/sniff_realtime/include/site/python3.7/pcapy:
    running install
    running build
    running build_ext
    building 'pcapy' extension
    creating build
    creating build/temp.linux-x86_64-3.7
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/talkiq/sniff_realtime/include -I/usr/include/python3.7m -c pcapdumper.cc -o build/temp.linux-x86_64-3.7/pcapdumper.o
    pcapdumper.cc:10:10: 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/local/talkiq/sniff_realtime/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-sdr47lrh/pcapy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-dae79fry/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/talkiq/sniff_realtime/include/site/python3.7/pcapy" failed with error code 1 in /tmp/pip-install-sdr47lrh/pcapy/
root@rs-dal-karthik-test:/usr/local/talkiq/sniff_realtime#

My python version and OS details are below

root@rs-dal-karthik-test:/usr/local/talkiq/sniff_realtime# python3 -V
Python 3.7.3rc1
root@rs-dal-karthik-test:/usr/local/talkiq/sniff_realtime# cat /etc/os-release 
PRETTY_NAME="Debian GNU/Linux buster/sid"
NAME="Debian GNU/Linux"
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

How do I fix this issue?

Guido0095 commented 5 years ago

Try to install python-dev or python3.7-dev

karthikdialpad commented 5 years ago

With python3.7-dev installed, I could install the pcapy, thanks for the help.