Set up a virtual env¶

It is recommended to run your Python setup within a virtual environment. This guide shows three different examples how to create a virtual environment with pyenv virtualenv, poetry, or Anaconda. You can follow the instructions or choose your preferred setup.

Python Version¶

Flower requires at least Python 3.10.

Note

Due to a known incompatibility with ray, we currently recommend utilizing at most Python 3.11 for running Flower simulations.

Virtualenv with Pyenv/Virtualenv¶

One of the recommended virtual environment is pyenv/virtualenv. Please see Flower examples for details.

Once Pyenv is set up, you can use it to install Python Version 3.10 or above:

pyenv install 3.10.19

Create the virtualenv with:

pyenv virtualenv 3.10.19 flower-3.10.19

Activate the virtualenv by running the following command:

echo flower-3.10.19 > .python-version

Virtualenv with Poetry¶

The Flower examples are based on Poetry to manage dependencies. After installing Poetry you simply create a virtual environment with:

poetry shell

If you open a new terminal you can activate the previously created virtual environment with the following command:

source $(poetry env info --path)/bin/activate

Virtualenv with Anaconda¶

If you prefer to use Anaconda for your virtual environment then install and setup the conda package. After setting it up you can create a virtual environment with:

conda create -n flower-3.10.19 python=3.10.19

and activate the virtual environment with:

conda activate flower-3.10.19