Flower Nightly Build

raw JSON →
1.30.0.dev20260508 verified Sat May 09 auth: no python

Nightly pre-release of the Flower federated learning framework (Flower: A Friendly Federated AI Framework). Current version is 1.30.0.dev20260508, requires Python >=3.10,<4.0. Published daily from the main development branch. Not stable; use for testing and previewing upcoming features.

pip install flwr-nightly
error ModuleNotFoundError: No module named 'flwr'
cause Installed flwr-nightly but tried to import flwr. The package provides the flwr module, but pip may have named it differently? Actually, flwr-nightly provides the flwr module, so this error occurs if flwr is not installed and flwr-nightly is also missing.
fix
Run pip install flwr-nightly to install the nightly build.
error AttributeError: module 'flwr' has no attribute 'client'
cause In very old versions or if using a broken nightly, the client submodule may not be imported automatically.
fix
Use explicit import: from flwr import client or import flwr.client.
error ImportError: cannot import name 'NumPyClient' from 'flwr.client'
cause NumPyClient was renamed to something else in nightly builds (e.g., Client). Check the current API.
fix
Check the nightly documentation for the correct class name. Use from flwr.client import Client and adjust accordingly.
breaking Nightly builds may introduce breaking changes without notice. Do not use in production or as a pinned dependency for reproducible experiments.
fix Use stable release flwr instead for production. Pin a specific nightly if needed, but expect instability.
deprecated The legacy strategy API (e.g., flwr.server.strategy.FedAvg) is being replaced by the Message API. In nightly builds, some strategies may be removed or renamed.
fix Use the new Message API strategies from flwr.server.strategy (e.g., FedAvgMessage). Refer to migration guide.
gotcha Installing flwr-nightly may conflict with a stable flwr installation. pip may uninstall flwr in favor of flwr-nightly.
fix Use a virtual environment to isolate nightly builds. Do not install both flwr and flwr-nightly in the same environment.

Quickstart example: a Flower client using NumPyClient with TensorFlow.

import flwr as fl
import tensorflow as tf

# Define a simple client
class CifarClient(fl.client.NumPyClient):
    def __init__(self):
        self.model = tf.keras.applications.ResNet50(weights=None, input_shape=(32,32,3), classes=10)
        self.model.compile('adam', 'sparse_categorical_crossentropy', metrics=['accuracy'])
        (x_train, y_train), (x_test, y_test) = tf.keras.datasets.cifar10.load_data()
        self.x_train, self.y_train = x_train.astype('float32')/255, y_train
        self.x_test, self.y_test = x_test.astype('float32')/255, y_test

    def get_parameters(self, config):
        return self.model.get_weights()

    def fit(self, parameters, config):
        self.model.set_weights(parameters)
        self.model.fit(self.x_train, self.y_train, epochs=1, verbose=0)
        return self.model.get_weights(), len(self.x_train), {}

    def evaluate(self, parameters, config):
        self.model.set_weights(parameters)
        loss, acc = self.model.evaluate(self.x_test, self.y_test, verbose=0)
        return loss, len(self.x_test), {'accuracy': acc}

# Start client
fl.client.start_numpy_client(server_address='127.0.0.1:8080', client=CifarClient())