From 05ad3229d760f9a70ec72885730466e56d3959ae Mon Sep 17 00:00:00 2001 From: David Hovstadius Date: Wed, 2 Oct 2024 10:37:07 +0200 Subject: [PATCH 1/9] Fixed windows env command --- docs/quickstart.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/quickstart.rst b/docs/quickstart.rst index ea96b8171..69c4bc73f 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -141,7 +141,7 @@ Start a client (using a 10-split and the 1st partition) by running the following .. code-tab:: bash :caption: Windows (Powershell) - $env:FEDN_PACKAGE_EXTRACT_DIR="package" + $env:FEDN_PACKAGE_EXTRACT_DIR="./package" $env:FEDN_NUM_DATA_SPLITS=10 $env:FEDN_DATA_PATH="./data/clients/1/mnist.pt" fedn run client -in client.yaml --secure=True --force-ssl From c031404a05f5d118855e660c8163b9872d4c4c0b Mon Sep 17 00:00:00 2001 From: David Hovstadius Date: Wed, 2 Oct 2024 11:34:26 +0200 Subject: [PATCH 2/9] Added a recommended step of setting up a virtual environment, and changing from / to \ in the PowerShell command lines to better match standard conventions for path in PowerShell --- docs/quickstart.rst | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/docs/quickstart.rst b/docs/quickstart.rst index 69c4bc73f..b76a6aa2f 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -24,6 +24,31 @@ You will see a Studio project similar to the image below. The Studio project pro .. image:: img/studio_project_overview.png +1.5 Set up a Virtual environment (Recommended) +---------------------------------------------- + +Before installing FEDn using pip, we recommend creating a virtual environment. This helps isolate dependencies and avoids conflicts with other Python projects on your machine. + +You can set up and activate a virtual environment using the following steps: + +**Using venv** (Python's built-in module for virtual environments) + +.. tabs:: + + .. code-tab:: bash + :caption: Unix/MacOS + + python3 -m venv fedn_env + source fedn_env/bin/activate + + .. code-tab:: bash + :caption: Windows (Powershell) + + python -m venv fedn_env + .\fedn_env\Scripts\Activate + +After activating the virtual environment, you can proceed with the next steps. + 2. Prepare the clients and define the global model --------------------------------------------------- @@ -141,9 +166,9 @@ Start a client (using a 10-split and the 1st partition) by running the following .. code-tab:: bash :caption: Windows (Powershell) - $env:FEDN_PACKAGE_EXTRACT_DIR="./package" + $env:FEDN_PACKAGE_EXTRACT_DIR=".\package" $env:FEDN_NUM_DATA_SPLITS=10 - $env:FEDN_DATA_PATH="./data/clients/1/mnist.pt" + $env:FEDN_DATA_PATH=".\data\clients\1\mnist.pt" fedn run client -in client.yaml --secure=True --force-ssl Repeat these two steps (generate an access token and start a local client) for the number of clients you want to use. From 6bd68cf58722501407cd634cac2b21325dc315ec Mon Sep 17 00:00:00 2001 From: David Hovstadius Date: Wed, 2 Oct 2024 11:46:36 +0200 Subject: [PATCH 3/9] Added a short text line --- docs/quickstart.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/quickstart.rst b/docs/quickstart.rst index b76a6aa2f..b33fa984f 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -75,7 +75,7 @@ Clone the FEDn repository and install the package: cd fedn pip install . -It is recommended to use a virtual environment when installing FEDn. +It is recommended to use a virtual environment when installing FEDn. (See step 1.5) .. _package-creation: From b7231adbcb056ecf2890a9e255413d4eb7ea724e Mon Sep 17 00:00:00 2001 From: David Hovstadius Date: Wed, 2 Oct 2024 11:50:05 +0200 Subject: [PATCH 4/9] Removed redundant text --- docs/quickstart.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/quickstart.rst b/docs/quickstart.rst index b33fa984f..60782e34d 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -75,7 +75,6 @@ Clone the FEDn repository and install the package: cd fedn pip install . -It is recommended to use a virtual environment when installing FEDn. (See step 1.5) .. _package-creation: From 35061551f23c0bb7213273de75fa45b4388478c6 Mon Sep 17 00:00:00 2001 From: David Hovstadius Date: Wed, 2 Oct 2024 15:32:39 +0200 Subject: [PATCH 5/9] Added copy code buttons --- docs/conf.py | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/conf.py b/docs/conf.py index 68193fb2b..cf52c4baf 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -24,6 +24,7 @@ "sphinx.ext.viewcode", "sphinx_rtd_theme", "sphinx_code_tabs", + "sphinx_copybutton", ] # The master toctree document. From 33bdc4b3fd568b2ef52d7119582eb12a9d3f8451 Mon Sep 17 00:00:00 2001 From: David Hovstadius Date: Wed, 2 Oct 2024 15:44:09 +0200 Subject: [PATCH 6/9] Added sphinx_copybutton to requirements --- docs/requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/requirements.txt b/docs/requirements.txt index 46a0b5e64..102f07e7e 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,2 +1,3 @@ sphinx-rtd-theme sphinx_code_tabs +sphinx-copybutton \ No newline at end of file From 98da15f7bca6269404c0ba731ba65f3492b4bd67 Mon Sep 17 00:00:00 2001 From: David Hovstadius Date: Wed, 2 Oct 2024 16:28:10 +0200 Subject: [PATCH 7/9] Added a new line for windows venv, to handle permission errors --- docs/quickstart.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/quickstart.rst b/docs/quickstart.rst index 60782e34d..bf0999e7c 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -42,9 +42,10 @@ You can set up and activate a virtual environment using the following steps: source fedn_env/bin/activate .. code-tab:: bash - :caption: Windows (Powershell) + :caption: Windows (PowerShell) python -m venv fedn_env + Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass .\fedn_env\Scripts\Activate After activating the virtual environment, you can proceed with the next steps. @@ -163,7 +164,7 @@ Start a client (using a 10-split and the 1st partition) by running the following fedn run client -in client.yaml --secure=True --force-ssl .. code-tab:: bash - :caption: Windows (Powershell) + :caption: Windows (PowerShell) $env:FEDN_PACKAGE_EXTRACT_DIR=".\package" $env:FEDN_NUM_DATA_SPLITS=10 From e7b3012058ca92f50fd25fe2ee996734d27500c2 Mon Sep 17 00:00:00 2001 From: David Hovstadius Date: Wed, 9 Oct 2024 17:32:17 +0200 Subject: [PATCH 8/9] Fixed the activating venv in PS and CMD, and changed run client to client start --- docs/quickstart.rst | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/docs/quickstart.rst b/docs/quickstart.rst index bf0999e7c..b09b009a9 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -45,8 +45,17 @@ You can set up and activate a virtual environment using the following steps: :caption: Windows (PowerShell) python -m venv fedn_env - Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass - .\fedn_env\Scripts\Activate + Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser + fedn_env\Scripts\Activate.ps1 + + .. code-tab:: bash + :caption: Windows (CMD.exe) + + python -m venv fedn_env + fedn_env\Scripts\activate.bat + + +For additional information visit the `Python venv documentation `_. After activating the virtual environment, you can proceed with the next steps. @@ -161,7 +170,7 @@ Start a client (using a 10-split and the 1st partition) by running the following export FEDN_PACKAGE_EXTRACT_DIR=package export FEDN_NUM_DATA_SPLITS=10 export FEDN_DATA_PATH=./data/clients/1/mnist.pt - fedn run client -in client.yaml --secure=True --force-ssl + fedn client start -in client.yaml --secure=True --force-ssl .. code-tab:: bash :caption: Windows (PowerShell) @@ -169,7 +178,16 @@ Start a client (using a 10-split and the 1st partition) by running the following $env:FEDN_PACKAGE_EXTRACT_DIR=".\package" $env:FEDN_NUM_DATA_SPLITS=10 $env:FEDN_DATA_PATH=".\data\clients\1\mnist.pt" - fedn run client -in client.yaml --secure=True --force-ssl + fedn client start -in client.yaml --secure=True --force-ssl + + .. code-tab:: bash + :caption: Windows (CMD.exe) + + set FEDN_PACKAGE_EXTRACT_DIR=.\package + set FEDN_NUM_DATA_SPLITS=10 + set FEDN_DATA_PATH=.\data\clients\1\mnist.pt + fedn client start -in client.yaml --secure=True --force-ssl + Repeat these two steps (generate an access token and start a local client) for the number of clients you want to use. A normal laptop should be able to handle several clients for this example. Remember to use different partitions for each client, by changing the number in the ``FEDN_DATA_PATH`` variable. From 459465845cd7a58c849c594c42ab9ae80513bb5e Mon Sep 17 00:00:00 2001 From: David Hovstadius Date: Thu, 10 Oct 2024 11:16:38 +0200 Subject: [PATCH 9/9] Added CMD.exe instructions --- docs/quickstart.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/quickstart.rst b/docs/quickstart.rst index b09b009a9..02c4d6426 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -183,9 +183,9 @@ Start a client (using a 10-split and the 1st partition) by running the following .. code-tab:: bash :caption: Windows (CMD.exe) - set FEDN_PACKAGE_EXTRACT_DIR=.\package + set FEDN_PACKAGE_EXTRACT_DIR=.\package\\ set FEDN_NUM_DATA_SPLITS=10 - set FEDN_DATA_PATH=.\data\clients\1\mnist.pt + set FEDN_DATA_PATH=.\data\\clients\\1\\mnist.pt fedn client start -in client.yaml --secure=True --force-ssl