Open gubertoli opened 1 year ago
Thanks for the the detailed report @gubertoli, does it change anything if you do a pip install -U flwr[simulation]
(note the missing "
)?
The Flower tutorial installs 1.0 on Google Colab, but it's running on Python 3.7
Did you try changing "num_rounds=NUM_ROUNDS," to "config=fl.server.ServerConfig(num_rounds=NUM_ROUNDS)," ?
Thanks for the the detailed report @gubertoli, does it change anything if you do a
pip install -U flwr[simulation]
(note the missing"
)?The Flower tutorial installs 1.0 on Google Colab, but it's running on Python 3.7
It is going to flwr 0.16.0 also without ", follows an output sample:
(venv) C:\Users\gustavo\example-nids-fl>pip install -U flwr[simulation]
Requirement already satisfied: flwr[simulation] in c:\users\gustavo\example-nids-fl\venv\lib\site-packages (1.0.0)
Requirement already satisfied: iterators<0.0.3,>=0.0.2 in c:\users\gustavo\example-nids-fl\venv\lib\site-packages (from flwr[simulation]) (0.0.2)
Requirement already satisfied: numpy<2.0.0,>=1.21.0 in c:\users\gustavo\example-nids-fl\venv\lib\site-packages (from flwr[simulation]) (1.23.2)
Requirement already satisfied: grpcio<2.0.0,>=1.43.0 in c:\users\gustavo\example-nids-fl\venv\lib\site-packages (from flwr[simulation]) (1.47.0)
Requirement already satisfied: protobuf<4.0.0,>=3.19.0 in c:\users\gustavo\example-nids-fl\venv\lib\site-packages (from flwr[simulation]) (3.19.4)
Collecting flwr[simulation]
Using cached flwr-1.0.0-py3-none-any.whl (90 kB)
Using cached flwr-0.19.0-py3-none-any.whl (106 kB)
Using cached flwr-0.18.0-py3-none-any.whl (106 kB)
Collecting grpcio<=1.43.0,>=1.27.2
Using cached grpcio-1.43.0-cp310-cp310-win_amd64.whl (3.4 MB)
Requirement already satisfied: google<3.0.0,>=2.0.3 in c:\users\gustavo\example-nids-fl\venv\lib\site-packages (from flwr[simulation]) (2.0.3)
Collecting flwr[simulation]
Using cached flwr-0.17.0-py3-none-any.whl (229 kB)
Using cached flwr-0.16.0-py3-none-any.whl (216 kB)
WARNING: flwr 0.16.0 does not provide the extra 'simulation'
Requirement already satisfied: beautifulsoup4 in c:\users\gustavo\example-nids-fl\venv\lib\site-packages (from google<3.0.0,>=2.0.3->flwr[simulation]) (4.11.1)
Requirement already satisfied: six>=1.5.2 in c:\users\gustavo\example-nids-fl\venv\lib\site-packages (from grpcio<2.0.0,>=1.43.0->flwr[simulation]) (1.16.0)
Requirement already satisfied: soupsieve>1.2 in c:\users\gustavo\example-nids-fl\venv\lib\site-packages (from beautifulsoup4->google<3.0.0,>=2.0.3->flwr[simulation]) (2.3.2.post1)
Installing collected packages: flwr
Attempting uninstall: flwr
Found existing installation: flwr 1.0.0
Uninstalling flwr-1.0.0:
Successfully uninstalled flwr-1.0.0
Successfully installed flwr-0.16.0
Did you try changing "num_rounds=NUM_ROUNDS," to "config=fl.server.ServerConfig(num_rounds=NUM_ROUNDS)," ?
Good point, I just checked the changes for simulation from 0.19.0
to 1.0.0
here. However, even complying with the new syntax, still outputs:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
Input In [29], in <cell line: 13>()
4 strategy=fl.server.strategy.FedAvg(
5 #fraction_fit=0.1, # Sample 10% of available clients for training
6 #fraction_evaluate=0.05, # Sample 5% of available clients for evaluation
(...)
9 #min_available_clients=int(NUM_CLIENTS * 0.75), # Wait until at least 75 clients are available
10 )
12 # Start simulation
---> 13 fl.simulation.start_simulation(
14 client_fn=client_fn,
15 num_clients=NUM_CLIENTS,
16 config=fl.server.ServerConfig(num_rounds=5),
17 strategy=strategy,
18 )
File ~\example-nids-fl\venv\lib\site-packages\flwr\simulation\__init__.py:33, in start_simulation(*args, **kwargs)
31 def start_simulation(*args, **kwargs): # type: ignore
32 """Print error stating that ray is missing."""
---> 33 raise ImportError(RAY_IMPORT_ERROR)
ImportError: Unable to import module `ray`.
To install the necessary dependencies, install `flwr` with the `simulation` extra:
pip install -U flwr["simulation"]
I have the same issue and my python version is Python 3.10.4. Could it be because of the python version?
@shg550 @gubertoli could your try this again with Flower 1.1 (which was released two days ago)? The ray
dependency has been updated, so it might work better with more recent versions of Python
@danieljanes just tested with Flower 1.1 and the problem still happens:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
Input In [26], in <cell line: 13>()
4 strategy=fl.server.strategy.FedAvg(
5 #fraction_fit=0.1, # Sample 10% of available clients for training
6 #fraction_evaluate=0.05, # Sample 5% of available clients for evaluation
(...)
9 #min_available_clients=int(NUM_CLIENTS * 0.75), # Wait until at least 75 clients are available
10 )
12 # Start simulation
---> 13 fl.simulation.start_simulation(
14 client_fn=client_fn,
15 num_clients=NUM_CLIENTS,
16 config=fl.server.ServerConfig(num_rounds=5),
17 strategy=strategy,
18 )
File ~\Downloads\example-nids-fl\venv\lib\site-packages\flwr\simulation\__init__.py:33, in start_simulation(*args, **kwargs)
31 def start_simulation(*args, **kwargs): # type: ignore
32 """Log error stating that module `ray` could not be imported."""
---> 33 raise ImportError(RAY_IMPORT_ERROR)
ImportError: Unable to import module `ray`.
To install the necessary dependencies, install `flwr` with the `simulation` extra:
pip install -U flwr["simulation"]
If I run pip install -U flwr["simulation"]
, then it downgrades to 0.16.0
, as follows:
Requirement already satisfied: flwr[simulation] in c:\users\gustavo\downloads\example-nids-fl\venv\lib\site-packages (1.1.0)
Requirement already satisfied: numpy<2.0.0,>=1.21.0 in c:\users\gustavo\downloads\example-nids-fl\venv\lib\site-packages (from flwr[simulation]) (1.23.2)
Requirement already satisfied: protobuf<4.0.0,>=3.19.0 in c:\users\gustavo\downloads\example-nids-fl\venv\lib\site-packages (from flwr[simulation]) (3.19.4)
Requirement already satisfied: grpcio<2.0.0,>=1.43.0 in c:\users\gustavo\downloads\example-nids-fl\venv\lib\site-packages (from flwr[simulation]) (1.47.0)
Requirement already satisfied: iterators<0.0.3,>=0.0.2 in c:\users\gustavo\downloads\example-nids-fl\venv\lib\site-packages (from flwr[simulation]) (0.0.2)
Collecting flwr[simulation]
Using cached flwr-1.1.0-py3-none-any.whl (121 kB)
Using cached flwr-1.0.0-py3-none-any.whl (90 kB)
Using cached flwr-0.19.0-py3-none-any.whl (106 kB)
Using cached flwr-0.18.0-py3-none-any.whl (106 kB)
Requirement already satisfied: google<3.0.0,>=2.0.3 in c:\users\gustavo\downloads\example-nids-fl\venv\lib\site-packages (from flwr[simulation]) (2.0.3)
Collecting grpcio<=1.43.0,>=1.27.2
Using cached grpcio-1.43.0-cp310-cp310-win_amd64.whl (3.4 MB)
Collecting flwr[simulation]
Using cached flwr-0.17.0-py3-none-any.whl (229 kB)
Using cached flwr-0.16.0-py3-none-any.whl (216 kB)
Requirement already satisfied: beautifulsoup4 in c:\users\gustavo\downloads\example-nids-fl\venv\lib\site-packages (from google<3.0.0,>=2.0.3->flwr[simulation]) (4.11.1)
Requirement already satisfied: six>=1.5.2 in c:\users\gustavo\downloads\example-nids-fl\venv\lib\site-packages (from grpcio<2.0.0,>=1.43.0->flwr[simulation]) (1.16.0)
Requirement already satisfied: soupsieve>1.2 in c:\users\gustavo\downloads\example-nids-fl\venv\lib\site-packages (from beautifulsoup4->google<3.0.0,>=2.0.3->flwr[simulation]) (2.3.2.post1)
Installing collected packages: flwr
Attempting uninstall: flwr
Found existing installation: flwr 1.1.0
Uninstalling flwr-1.1.0:
Successfully uninstalled flwr-1.1.0
Successfully installed flwr-0.16.0
WARNING: flwr 0.16.0 does not provide the extra 'simulation'
WARNING: You are using pip version 22.0.4; however, version 22.3.1 is available.
You should consider upgrading via the 'C:\Users\gustavo\Downloads\example-nids-fl\venv\Scripts\python.exe -m pip install --upgrade pip' command.
The setup in use:
Packages:
I am still getting the same issue. My machine is a M2 chip, with python==1.14 and flower==1.4.0. Nothing changes when I tried the installation pip install -U flwr["simulation"] and pip install -U flwr[simulation].
same issue on my M1 Mac.
But after I installed ray pip install -U "ray[default] @ LINK_TO_WHEEL.whl"
by following https://docs.ray.io/en/latest/ray-overview/installation.html, I successfully run the flwr.simulation
without installing flwr[simulation]. @joselsalmeron
I was having the same issue for my M1 mac.
Followed the steps @Happy2Git provided, and the process went smoothly! Thanks
I had this same issue with flwr 1.7.0 and Python 3.12 (trying pip install flwr[simulation] downgrades to flwr==0.16.0). To solve, I had to downgrade to Python 3.10.
Seems to be a problem between the Python version and Ray: https://discuss.ray.io/t/installing-ray-in-python-3-11-2/9431/2
Describe the bug
Hi, I am trying to use the flwr simulation in the version 1.0.0 with Python 3.10.5. However, when I start the simulation with
fl.simulation.start_simulation
, it presents the following:If I try to install the flwr with simulation extra as recommended, it downgrades to 0.16.0:
I tried the following without success:
pip install -U flwr["simulation"]==1.0.0
Steps/Code to Reproduce
Expected Results
Flower with simulation capabilities.
Actual Results
Not able to run simulations with flower 1.0.0.