pynetwork / pypcap

pypcap - python libpcap module, forked from code.google.com/p/pypcap
Other
299 stars 74 forks source link

Unable to install on Windows #35

Closed wgaylord closed 7 years ago

wgaylord commented 7 years ago

Runing pip install pypcap returns

 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\chibi\appdata\local\temp\pip-build-luqb2x\pypcap\

I am on windows... (Which might be the whole problem)

markcoker commented 7 years ago

http://www.winpcap.org/devel.htm Place these files in proper places, installs fine on windows.

nonZero commented 7 years ago

You should probably add some information on README.py regarding requirements. see: http://stackoverflow.com/questions/42567086/how-to-solve-this-pip-install-pypcap-error-both-in-windows-and-ubuntu-linux

hellais commented 7 years ago

It would be great if somebody with a windows machine and windows knowledge could open a PR with the relevant information on how to get it working on windows.

hellais commented 7 years ago

We now have better installation instructions for windows and @nuald made some changes to fix some of the issues you may have been encountering.

Feel free to re-open this ticket if it's not fixed.

geajack commented 5 years ago

http://www.winpcap.org/devel.htm Place these files in proper places, installs fine on windows.

What are "the proper places"?

hellais commented 5 years ago

@geajack check the windows instructions in the Readme: https://github.com/pynetwork/pypcap#installation-from-sources.

Please download the Npcap SDK, unpack the archive and put it into the sibling directory as wpdpack (setup.py will discover it).

drebbe-intrepid commented 5 years ago

I just ran into this issue also on Windows.

This is the solution:

Now to address this bug I recommend adding support in the setup.py to add an environment variable to the include path, Maybe something like PYPCAP_NPCAP_SDK so it can actually be installed through pip. If the environment variable is not found it should error out instead of complaining it can't find npcap.h.

pseudo code for setup.py find_prefix_and_pcap_h:

if windows:
    try:
        win_path = os.environ['PYPCAP_NPCAP_SDK']
        # append win_path to others
    except KeyError:
        print("Environment Variable 'PYPCAP_NPCAP_SDK' needs to be set for Windows installations.")

I'm unfamiliar with the project and the setup script so hopefully this makes sense.