Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs/SK-1078 | Added virtual environment details in quickstart #715

Merged
merged 10 commits into from
Oct 11, 2024
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"sphinx.ext.viewcode",
"sphinx_rtd_theme",
"sphinx_code_tabs",
"sphinx_copybutton",
]

# The master toctree document.
Expand Down
33 changes: 29 additions & 4 deletions docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,32 @@ 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
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
.\fedn_env\Scripts\Activate
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have you tested this? I was not able to do this is my powershell because of admin rights, instead I used CMD.exe and then there is a .bat file to activate instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll do further testing later today on my windows machine.
Wouldn't switching to CMD be a bad decision since we later use PowerShell to start the clients?
A workaround could also be starting PowerShell in admin mode?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested it and it works on my windows machine, I've added a line to bypass the admin permissions if that error shows up


After activating the virtual environment, you can proceed with the next steps.

2. Prepare the clients and define the global model
---------------------------------------------------

Expand All @@ -50,7 +76,6 @@ Clone the FEDn repository and install the package:
cd fedn
pip install .

It is recommended to use a virtual environment when installing FEDn.

.. _package-creation:

Expand Down Expand Up @@ -139,11 +164,11 @@ 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_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.
Expand Down
1 change: 1 addition & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
sphinx-rtd-theme
sphinx_code_tabs
sphinx-copybutton
Loading