SkypLabs / probequest

Toolkit for Playing with Wi-Fi Probe Requests
https://probequest.skyplabs.net/en/stable/
GNU General Public License v3.0
260 stars 49 forks source link

Modulenotfound error after install in Raspberry Pi OS Lite kernel 5.15 #61

Open linxcow opened 1 year ago

linxcow commented 1 year ago

I used the method described in the online help to install using pip3

I set the wifi card in monitor mode ( checked using iw wlan info)

after launching i get following messages

pi@raspberrypi:~/.local/bin $ sudo ./probequest wlan0
Traceback (most recent call last):
  File "/home/pi/.local/bin/./probequest", line 5, in <module>
    from probequest.cli import main
 ModuleNotFoundError: No module named 'probequest'

platform Python 3.9

>>> print(os.sys.path)
['', '/usr/lib/python39.zip', '/usr/lib/python3.9', '/usr/lib/python3.9/lib-dynload', '/home/pi/.local/lib/python3.9/site-packages', '/usr/local/lib/python3.9/dist-packages', '/usr/lib/python3/dist-packages', '/usr/lib/python3.9/dist-packages']
SkypLabs commented 1 year ago

Hi @linxcow,

Thanks for reporting this. It made me realise that the documentation is not clear enough.

Indeed, when installing ProbeQuest via pip3 install --upgrade probequest, the entry point is placed in ~/.local/bin/probequest (/home/pi/.local/bin/probequest in your case), and the Python modules in ~/.local/lib. The problem comes from the fact that ProbeQuest requires root privileges to sniff raw Wi-Fi packets, and that the Python interpreter cannot locate ProbeQuest's dependencies when run with a different user than the one used to install ProbeQuest.

In a previous version of the documentation, users were instructed to install ProbeQuest with the root user via sudo pip3 install --upgrade probequest, but this was a bad practice as it "may interfere with the operation of the system package manager and other components of the system if a component is unexpectedly upgraded using pip" as stated in the Python documentation. This is why I removed the "sudo" prefix from the installation command-line in the documentation but I forgot to update the rest of the instructions.

From the top of my head, I can see two workarounds:

  1. Manually specify the location of ProbeQuest's dependencies via the PYTHONPATH environment variable: sudo PYTHONPATH=/home/pi/.local/lib/python3.9/site-packages/ /home/pi/.local/bin/probequest
  2. Use a dedicated virtual environment:

    # Create a new virtual environment.
    python -m venv .probequest-venv
    
    # Enter the virtual environment.
    source .probequest-venv/bin/activate
    
    # Install ProbeQuest inside the virtual environment.
    pip install probequest
    
    # Leave the virtual environment.
    deactivate
    
    # Run ProbeQuest installed inside the virtual environment via sudo.
    sudo .probequest-venv/bin/probequest

I acknowledge that this is not ideal but I will try to find a better way. In all cases, I will update the installation instructions in the documentation.