Search code examples
pythonraspberry-pipcap

Import pcap on raspberry


I'm trying to load the module pcap of the python library pypcap 1.2.2, but when i try to import it, i got the following error:

import pcap
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "build/bdist.linux-armv6l/egg/pcap.py", line 7, in <module>
   File "build/bdist.linux-armv6l/egg/pcap.py", line 6, in __bootstrap__
ImportError: /root/.cache/Python-Eggs/pypcap-1.2.2-py2.7-linux-armv6l.egg-tmp/pcap.so: undefined symbol: pcap_set_immediate_mode

my system info are:

Linux raspberrypi 3.19.3+ #35 PREEMP armv6l GNU/Linux 

Any idea?


Solution

  • Looks like pypcap requires pcap_set_immediate_mod. Unfortunately, that function was added in libpcap v1.5.0 and you have libpcap v1.3.0-1. It looks like pypcap requires pcap_set_immediate_mod since v1.2.1.


    Solution 1

    Install a more recent version of libpcap-dev. If you can't find one available in your repositories, you can try to install it from sources.

    Solution 2

    Downgrade pypcap to a version < v1.2.1. That's not guaranteed to solve your issue though, since some other function might be required once you downgraded. I couldn't find any documentation on which version of libpcap is required for each version of pypcap :-/