Installation

Depending on how you want to set up OpenFL, choose one of the following installation procedure.

Install the Package

Follow this procedure to prepare the environment and install the OpenFL package. Perform this procedure on every node in the federation.

  1. Install a Python 3.8 (>=3.6, <3.9) virtual environment using venv.

See the Venv installation guide for details.

  1. Create a new Virtualenv environment for the project.

    $ python3 -m venv venv
    
  2. Activate the virtual environment.

    $ source venv/bin/activate
    
  3. Install the OpenFL package.

    1. Installation from PyPI:

      $ python -m pip install openfl
      
    2. Installation from source:

      1. Clone the OpenFL repository:

        $ git clone https://github.com/intel/openfl.git
        
      2. Install build tools, before installing OpenFL:

        $ python -m pip install -U pip setuptools wheel
        $ cd openfl/
        $ python -m pip install .
        
  4. Run the fx command in the virtual environment to confirm OpenFL is installed.

    OpenFL - Open Federated Learning
    
    BASH COMPLETE ACTIVATION
    
    Run in terminal:
       _FX_COMPLETE=bash_source fx > ~/.fx-autocomplete.sh
       source ~/.fx-autocomplete.sh
    If ~/.fx-autocomplete.sh has already exist:
       source ~/.fx-autocomplete.sh
    
    CORRECT USAGE
    
    fx [options] [command] [subcommand] [args]
    
    GLOBAL OPTIONS
    
    -l, --log-level TEXT  Logging verbosity level.
    --no-warnings         Disable third-party warnings.
    --help                Show this message and exit.
    
    AVAILABLE COMMANDSAVAILABLE COMMANDS
    
    plan              Manage Federated Learning Plans.
    ────────────────────────────────────────────────────────────────────────────────
      * freeze       Finalize the Data Science plan.
      * initialize   Initialize Data Science plan.
      * print        Print the current plan.
      * remove       Remove this plan.
      * save         Save the current plan to this plan and...
      * switch       Switch the current plan to this plan.
    

Output of the fx Command

OpenFL with Docker*

Follow this procedure to download or build a Docker* image of OpenFL, which you can use to run your federation in an isolated environment.

Note

The Docker* version of OpenFL is to provide an isolated environment complete with the prerequisites to run a federation. When the execution is over, the container can be destroyed and the results of the computation will be available on a directory on the local host.

  1. Install Docker on all nodes in the federation.

See the Docker installation guide for details.

  1. Check that Docker is running properly with the Hello World command:

    $ docker run hello-world
    Hello from Docker!
    This message shows that your installation appears to be working correctly.
    ...
    ...
    ...
    
  2. Build an image from the latest official OpenFL release:

    $ docker pull intel/openfl
    

    If you prefer to build an image from a specific commit or branch, perform the following commands:

    $ git clone https://github.com/intel/openfl.git
    $ cd openfl
    $ docker build -f openfl-docker/Dockerfile.base .