trouble installing pcapy on windows 7 - cannot open include file: 'pcap.h'

PurpleVermont picture PurpleVermont · Apr 10, 2014 · Viewed 13.3k times · Source

I am trying to install pcapy on a Windows machine. I have already installed WinPcap 4.1.3

I downloaded pcapy 0.10.8 into C:\pcapy-0.10.8

When I try to do the install, the following happens:

C:\pcapy-0.10.8>c:\Python27\python.exe setup.py install
running install
running build
running build_ext
building 'pcapy' extension
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\Bin\amd64\cl.exe /c /nolog o /Ox /MD /W3 /GS- /DNDEBUG -DWIN32=1 -Ic:\devel\oss\wpdpack\Include -Ic:\Python27\include -Ic:\Python27\PC /Tppcapdumper.cc /Fobuild\temp.win-amd64-2.7\Release \pcapdumper.obj
pcapdumper.cc
pcapdumper.cc(12) : fatal error C1083: Cannot open include file: 'pcap.h': No such file or directory
error: command 'cl.exe' failed with exit status 2

I don't know where it's looking for pcap.h. I can confirm that there is no file by that name in the pcapy-0.10.8 directory.

What am I missing? I just now installed WinPcap -- do I need a reboot or something? Thanks!

Edited to add... here is the output from my WinPcap install log:

WinPcap 4.1.0.2980 Installation LOG
-----------------------------------------------------
Debug Information


Operating system detected on registry: 7 - AMD64
True operating system (kernel.dll):    7 - AMD64
npptools.dll present on the system:    false
netnm.inf present on the system:       false
nmnt.sys present on the system:        false

End of log
-----------------------------------------------------

Do the falses there mean that WinPcap did not get installed properly? I was hoping to find pcap.h under my WinPcap directory, but it's not there. I do see where I could add additional include file directories in the setup.py if needed, but I can't find pcap.h anywhere on my machine. Where am I supposed to be getting that from?

Answer

user862787 picture user862787 · Apr 11, 2014
C:\pcapy-0.10.8>c:\Python27\python.exe setup.py install

From the text on the CoreLabs site for pcapy, that suggests that you downloaded the source rather than the Win32 binary. Unless you really need to build from source, you will probably find it a LOT easier to just install the binary.

Do the falses there mean that WinPcap did not get installed properly?

No.

I was hoping to find pcap.h

Then, IF you NEED to build from source, you need to install the WinPcap Developer's Pack. WinPcap is just the "run time", sufficient for programs such as Wireshark that have already been built, but not sufficient for software that uses WinPcap and that need to be compiled on your machine - and, apparently, whatever flavor of pcapy you downloaded needs to be built.

(This is similar to the way libpcap is packaged on many Linux distributions - the "libpcap" package just installs the run time, and you need to install a "libpcap-dev" package, or something such as that, to get the header files.)

But if the Windows binary works for you, don't bother with the WinPcap developer's pack.