Problem when trying to install federated plugin

Hello, it’s been weeks that i’ve been trying to install xgboost’s federated plugin, but i always get cmake errors whenever i try to build the plugin. I am trying to use the plugin in order to execute xgboost in the nvidia simulator in a federated way. I am trying to do this in google colab since i have a mac. Is there a comprehensible guide i can follow?

In particular, whenever i try to build following the instructions reported here: https://github.com/dmlc/xgboost/tree/master/plugin/federated

i get the following error:
"
CMake Error at plugin/federated/CMakeLists.txt:4 (find_package):
Could not find a package configuration file provided by “Protobuf” with any
of the following names:

ProtobufConfig.cmake
protobuf-config.cmake

Add the installation prefix of “Protobuf” to CMAKE_PREFIX_PATH or set
“Protobuf_DIR” to a directory containing one of the above files. If
“Protobuf” provides a separate development package or SDK, be sure it has
been installed.

"

Any help would be appreciated!

The official Python package already includes the federated plugin. Have you tried using the federated learning example after running pip install xgboost?

yes, but when i try to run nvflare’s federated xgboost example given here: https://github.com/NVIDIA/NVFlare/tree/main/examples/advanced/xgboost
i get the following error: “xgboost.core.XGBoostError: XGBoost needs to be built with the federated learning plugin enabled in order to use this module”.
So i tried to build it myself using dmlc github xgboost repository.

Are you using Linux with amd64 CPU on Google Colab?

Also make sure you are using the latest version of XGBoost.

1 Like

Are you building it on a mac? Probably need to follow the instructions to build gRPC first: https://grpc.io/docs/languages/cpp/quickstart/

1 Like

is google colab or amd64 linux preferred? I am running into the same issue, not sure which I need to use.

@rongou after following those instructions I am still experiencing the same issue.

My steps are:

  • clone repo
  • run the tutorial at examples/advanced/xgboost/data_job_setup.ipynb
  • run the code at examples/advanced/xgboost/histogram-based/xgboost_histogram_higgs.ipynb
    While the code is running my output is as follows:
2023-06-28 19:31:18,706 - ServerRunner - INFO - [identity=simulator_server, run=simulate_job]: Workflow xgb_controller (<class 'nvflare.app_opt.xgboost.histogram_based.controller.XGBFedController'>) started
2023-06-28 19:31:18,707 - XGBFedController - INFO - [identity=simulator_server, run=simulate_job, wf=xgb_controller]: Begin XGBoost training phase.
2023-06-28 19:31:18,707 - XGBFedController - INFO - [identity=simulator_server, run=simulate_job, wf=xgb_controller]: scheduled task train
2023-06-28 19:31:18,935 - SimulatorClientRunner - INFO - Start the clients run simulation.
Process Process-2:1:
Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/miniconda/base/envs/nih_fl/lib/python3.10/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/opt/homebrew/Caskroom/miniconda/base/envs/nih_fl/lib/python3.10/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/nih_fl/lib/python3.10/site-packages/xgboost/federated.py", line 42, in run_federated_server
    raise XGBoostError(
xgboost.core.XGBoostError: XGBoost needs to be built with the federated learning plugin enabled in order to use this module
2023-06-28 19:31:19,952 - SimulatorClientRunner - INFO - Simulate Run client: site-1
2023-06-28 19:31:19,956 - SimulatorClientRunner - INFO - Simulate Run client: site-2
2023-06-28 19:31:20,983 - ClientTaskWorker - INFO - ClientTaskWorker started to run
2023-06-28 19:31:20,984 - ClientTaskWorker - INFO - ClientTaskWorker started to run

Using python 3.10.12 on windows, after running “pip install xgboost”, I also get this error message: “xgboost.core.XGBoostError: XGBoost needs to be built with the federated learning plugin enabled in order to use this module”. However, with Ubuntu and the same versions of python and xgboost, it’s working. How can this be fixed on Windows?
Thank you

Federated learning is only supported in Linux at this moment.