nitred / nr-wg-mtu-finder

MIT License
202 stars 22 forks source link

requesting help with launching #9

Closed stone-w4tch3r closed 1 year ago

stone-w4tch3r commented 1 year ago

Hey! Thanks for a great tool. Unfortunately, i'm a complete noob at python. Struggled for several hours trying to launch scripts.

In readme it's just said nr-wg-mtu-finder --mode server --mtu-min 1280 --mtu-max 1290 --mtu-step 2 --server-ip 10.2.0.1 to start. But nr-wg-mtu-finder is not in PATH after pip installation.

Tried various ways of launching, after creating environment with venv:

1 $ python3 -m nr_wg_mtu_finder.main --mode peer --mtu-min 1200 --mtu-max 1600 --mtu-step 2 --server-ip 10.1.1.1

2 $ python3 -m nr_wg_mtu_finder /usr/bin/python3: No module named nr_wg_mtu_finder.__main__; 'nr_wg_mtu_finder' is a package and cannot be directly executed

3 Tried even connecting to server with vscode via ssh and running py files with f5. On file main.py getting this error: ... from .mtu_finder import MTUFinder ImportError: attempted relative import with no known parent package Other files just run a little and than close.


So, how should scripts be launched? Sorry for dumb question)

nitred commented 1 year ago

@stone-w4tch3r Apologies for the delay in replying. I am assuming you're running on some UNIX system (linux or macos). Could you follow these steps and let me know if it works:

  1. Make sure the python version is supported i.e. either 3.8.x or 3.9.x
    python3 --version
  2. Install the package in userspace and check if the nr-wg-mtu-finder is now available in your PATH.

    # First run this step to install the package in userspace.
    pip3 install nr-wg-mtu-finder==0.2.1 --upgrade --user
    
    # Check if the binary is now available. If it outputs a path like `/home/user/.local/bin/nr-wg-mtu-finder` then you're good to go!
    which nr-wg-mtu-finder
  3. Now you can run the command
    nr-wg-mtu-finder ...
stone-w4tch3r commented 1 year ago

@nitred thanks a lot for reply! With your help scripts are launched now! For those who may face same issue in future:

1 python3 --version Python 3.10.6 if your python has unsupported version, you will need to install another one

2 brew install python@3.9 install it with any package manager, brew in this example

3 python3.9 -m venv ~/python/nr-wg-mtu-finder-3.9 source python/nr-wg-mtu-finder-3.9/bin/activate create virtual environment and activate it

4 python3 --version Python 3.9.16 now your python has correct version

5 pip install nr-wg-mtu-finder==0.2.1 --upgrade install scripts via pip

6 nr-wg-mtu-finder ... it should be in PATH, run!