Initial setup

Installation

Clone the starting repository

Clone and enter the brainflex-node repository:

git clone https://github.com/neurodatascience/brainflex-node
cd brainflex-node

Create virtual environment and install Python dependencies

With uv

To install uv: https://docs.astral.sh/uv/getting-started/installation/ (sudo privileges not needed).

uv venv --python 3.14
source .venv/bin/activate
uv pip install -r requirements.txt

With venv

Make sure your Python version is between 3.11 and 3.14 inclusive.

python3 -m venv .venv --prompt brainflex-node
source .venv/bin/activate
pip install -r requirements.txt

With conda

conda create --name brainflex-node python=3.14
conda activate brainflex-node
pip install -r requirements.txt

Verify installation

The above step installs three packages/tools:

  1. bagel: Neurobagel CLI

  2. nipoppy: Nipoppy CLI

  3. brainflex: Custom helper tool for this project

You can verify that they were installed successfully by running <TOOL_NAME> --help, where <TOOL_NAME> is one of bagel, nipoppy, and brainflex. This should print information about the CLI commands and options.

Initial survey

Answer a short survey about your prior experience with Nipoppy, Neurobagel and Fed-BioMed:

brainflex initial-survey

Node configuration

Attention

The content of config.env and .env should not be openly shared.

config.env file

Put the config.env file that was shared with you in the vpn_config/ directory:

mv <PATH_TO_CONFIG_ENV_FILE> vpn_config/config.env

.env file

Create a .env file from the provided template:

cp .env.example .env

Edit .env and set:

  • FBM_NODE_NAME to the value of FEDBIOMED_NODEID in the config.env file that was shared with you

  • CONTAINER_UID and CONTAINER_GID to the output of id -u and id -g, respectively

Data download

Download the OpenNeuro dataset assigned to your site, replacing <DATASET_ID> with its ID. Your dataset ID is the second part of the FBM_NODE_NAME variable you just set in your .env file, beginning with ds (e.g. ds123456 in the example .env file above).

brainflex get-data <DATASET_ID>

The command may run for a few (maybe 3-5) minutes. It will create a minimal Nipoppy study in a new directory, nipoppy_study, that contains all the data needed for the federated learning experiment.

Note

To save disk space and download time, only the files needed for this experiment are downloaded: the raw imaging files are empty placeholders, and the FreeSurfer outputs only include the stats and scripts directories.