3

I get this error:

when I try to install the pypcap library (for Python 2.7.x) on either Windows 7 or Ubuntu 12.04:

The following is the Windows version of the error, but the Linux error is similar, and can post it later:

$ pip install pypcap -U
Collecting pypcap
  Using cached pypcap-1.1.5.tar.gz
    Complete output from command python setup.py egg_info:
    pcap.h not found

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\users\
<username>\appdata\local\temp\pip-build-qjf6rt\pypcap\

Thanks for any pointers or advice on this.

Udi
  • 29,222
  • 9
  • 96
  • 129
Vasudev Ram
  • 145
  • 1
  • 7

2 Answers2

4

You need the pcap development library.

On linux, try

sudo apt-get update
sudo apt-get install libpcap0.8-dev

I know nothing of Windows.

Link to relevant question.

Community
  • 1
  • 1
  • Thanks, Louis. The problem is now solved after I did a variation of what you suggested (googled some and the command you gave did not work, but this similar one did): apt-get install libpcap0.8-dev – Vasudev Ram Mar 03 '17 at 23:29
  • 2
    great! I changed my answer to reflect what worked for you. – Louis P. Dartez Mar 06 '17 at 03:50
1

The c library that pypcap depends on is not installed on your machine.

I suggest using Miniconda to manage your entire Python environment. You can install compiled packages for your architecture to your local conda environment, and then your pip command will succeed.

thaavik
  • 3,257
  • 2
  • 18
  • 25
  • Thanks. Will try that. Had actually thought using Anaconda myself, since I knew it has many more packages, and guessed some of them could be compiled ones. But ran out of disk space, for some reason, though doing df first, showed plenty of space. Going to try it or Miniconda again. – Vasudev Ram Mar 03 '17 at 23:28