Conda is not needed to install Flower and just loads additional complexity - it works quite happily with the standard pip command including in later versions of the Python 3 modules installed on our HPC facilities.
pip
The easiest approach is to load one of our Python software modules, and then create a new python venv area to hold it. In the example below we create the flowers folder with a new Python venv and use pip to install the latest Flowers package:
flowers
$ module load Python/3.11 $ python -m venv flower $ cd flower $ source bin/activate $ pip install flwr Collecting flwr Downloading flwr-1.16.0-py3-none-any.whl (532 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 532.1/532.1 kB 6.1 MB/s eta 0:00:00 Collecting cryptography<45.0.0,>=44.0.1 Downloading cryptography-44.0.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.2 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.2/4.2 MB 28.4 MB/s eta 0:00:00 ... ... Installing collected packages: ... $
If you need to install the ray dependency, just substitute the pip command for the one which installs flwr[simulation] instead:
ray
flwr[simulation]
$ module load Python/3.11 $ python -m venv flower $ cd flower $ source bin/activate $ pip install "flwr[simulation]" Collecting flwr Downloading flwr-1.16.0-py3-none-any.whl (532 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 532.1/532.1 kB 6.1 MB/s eta 0:00:00 Collecting cryptography<45.0.0,>=44.0.1 Downloading cryptography-44.0.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.2 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.2/4.2 MB 28.4 MB/s eta 0:00:00 Collecting ray==2.31.0 Downloading ray-2.31.0-cp311-cp311-manylinux2014_x86_64.whl (66.7 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 66.7/66.7 MB 19.3 MB/s eta 0:00:00 ... ... Installing collected packages: ... $
$ module load Python/3.11 $ cd flower $ source bin/activate $ python -c "import flwr;print(flwr.__version__)" 1.16.0 $
You will need to load the required Python software module, then activate the Flowers virtual environment:
$ module load Python/3.11 $ cd flower $ source bin/activate $ bin/flower-simulation --help usage: flower-simulation [-h] --app APP --num-supernodes NUM_SUPERNODES [--run-config RUN_CONFIG] [--backend BACKEND] [--backend-config BACKEND_CONFIG] [--enable-tf-gpu-growth] [--verbose] [--flwr-dir FLWR_DIR] [--run-id RUN_ID] Start a Flower simulation options: -h, --help show this help message and exit --app APP Path to a directory containing a FAB-like structure with a pyproject.toml. --num-supernodes NUM_SUPERNODES Number of simulated SuperNodes. --run-config RUN_CONFIG Override configuration key-value pairs. --backend BACKEND Simulation backend that executes the ClientApp. --backend-config BACKEND_CONFIG A JSON formatted stream, e.g '{"<keyA>":<value>, "<keyB>":<value>}' to configure a backend. Values supported in <value> are those included by `flwr.common.typing.ConfigsRecordValues`. --enable-tf-gpu-growth Enables GPU growth on the main thread. This is desirable if you make use of a TensorFlow model on your `ServerApp` while having your `ClientApp` running on the same GPU. Without enabling this, you might encounter an out-of-memory error because TensorFlow by default allocates all GPU memory.Read more about how `tf.config.experimental.set_memory_growth()` works in the TensorFlow documentation: https://www.tensorflow.org/api/stable. --verbose When unset, only INFO, WARNING and ERROR log messages will be shown. If set, DEBUG-level logs will be displayed. --flwr-dir FLWR_DIR The path containing installed Flower Apps. By default, this value is equal to: - `$FLWR_HOME/` if `$FLWR_HOME` is defined - `$XDG_DATA_HOME/.flwr/` if `$XDG_DATA_HOME` is defined - `$HOME/.flwr/` in all other cases --run-id RUN_ID Sets the ID of the run started by the Simulation Engine. $
Back to FAQ
Table of Contents
Main Content Sections
Documentation Tools