[ ] Critical/Blocker (select if the issue makes the application unusable or causes serious data loss)
[ ] High (select if the issue affects a major feature and there is no workaround or the available workaround is very complex)
[X] Medium (select if the issue affects a minor feature or affects a major feature but has an easy enough workaround to not cause any major inconvenience)
[ ] Low (select if the issue doesn't significantly affect the user experience, like minor visual bugs)
Describe the bug
I installed FedN into a conda environment using pip, to keep my base environment clean. I created a new folder containing the config.yaml and ran using fedn run client -in client.yaml --secure=True --force-ssl. A virtual environment was created, but I got an error message saying:
A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.1.1 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.
If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.
Traceback (most recent call last): File "/Users/Admin/Documents/FedN/package/client/data.py", line 4, in
import torch
File "/Users/Admin/Documents/FedN/package/client/mnist-pytorch/lib/python3.12/site-packages/torch/init.py", line 1477, in
from .functional import # noqa: F403
File "/Users/Admin/Documents/FedN/package/client/mnist-pytorch/lib/python3.12/site-packages/torch/functional.py", line 9, in
import torch.nn.functional as F
File "/Users/Admin/Documents/FedN/package/client/mnist-pytorch/lib/python3.12/site-packages/torch/nn/init.py", line 1, in
from .modules import # noqa: F403
File "/Users/Admin/Documents/FedN/package/client/mnist-pytorch/lib/python3.12/site-packages/torch/nn/modules/init.py", line 35, in
from .transformer import TransformerEncoder, TransformerDecoder, \
File "/Users/Admin/Documents/FedN/package/client/mnist-pytorch/lib/python3.12/site-packages/torch/nn/modules/transformer.py", line 20, in
device: torch.device = torch.device(torch._C._get_default_device()), # torch.device('cpu'),
/Users/Admin/Documents/FedN/package/client/mnist-pytorch/lib/python3.12/site-packages/torch/nn/modules/transformer.py:20: UserWarning: Failed to initialize NumPy: _ARRAY_API not found (Triggered internally at /Users/runner/work/pytorch/pytorch/pytorch/torch/csrc/utils/tensor_numpy.cpp:84.)
device: torch.device = torch.device(torch._C._get_default_device()), # torch.device('cpu'),`
and
2024-10-02 14:43:15 [INFO] Client in TRAINING state. Traceback (most recent call last): File "/Users/Admin/Documents/FedN/package/client/train.py", line 77, in <module> train(sys.argv[1], sys.argv[2]) File "/Users/Admin/Documents/FedN/package/client/train.py", line 39, in train model = load_parameters(in_model_path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Admin/Documents/FedN/package/client/model.py", line 59, in load_parameters state_dict = collections.OrderedDict({key: torch.tensor(x) for key, x in params_dict}) ^^^^^^^^^^^^^^^ RuntimeError: Could not infer dtype of numpy.float32 2024-10-02 14:43:16 [INFO] Client in TRAINING state. 2024-10-02 14:43:16 [ERROR] Could not process training request due to error: Non-zero exit code: 1 Command: ['bash', '-c', 'source /Users/Admin/Documents/FedN/package/client/mnist-pytorch/bin/activate && python train.py /var/folders/qm/prmq9531019ff8d9k_81fljh0000gp/T/tmp3i49dw2t.npz /var/folders/qm/prmq9531019ff8d9k_81fljh0000gp/T/tmpeo3_8pq3.npz'] ^C2024-10-02 14:43:33 [INFO] Shutting down.
As prompted, I activated the virtual environment and installed numpy<2. I tried to join again and got the error:
`Client configuration loaded from file: client.yaml
Values set in file override defaults and command line arguments...
Traceback (most recent call last):
File "/Users/Admin/Documents/FedN/package/client/mnist-pytorch/bin/fedn", line 8, in
sys.exit(main())
^^^^^^
File "/Users/Admin/Documents/FedN/package/client/mnist-pytorch/lib/python3.12/site-packages/click/core.py", line 1157, in call
return self.main(args, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Admin/Documents/FedN/package/client/mnist-pytorch/lib/python3.12/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/Users/Admin/Documents/FedN/package/client/mnist-pytorch/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Admin/Documents/FedN/package/client/mnist-pytorch/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Admin/Documents/FedN/package/client/mnist-pytorch/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Admin/Documents/FedN/package/client/mnist-pytorch/lib/python3.12/site-packages/click/core.py", line 783, in invoke
return __callback(args, *kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Admin/Documents/FedN/package/client/mnist-pytorch/lib/python3.12/site-packages/click/decorators.py", line 33, in new_func
return f(get_current_context(), args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Admin/Documents/FedN/package/client/mnist-pytorch/lib/python3.12/site-packages/fedn/cli/run_cmd.py", line 273, in client_cmd
client = Client(config)
^^^^^^^^^^^^^^
File "/Users/Admin/Documents/FedN/package/client/mnist-pytorch/lib/python3.12/site-packages/fedn/network/clients/client.py", line 83, in init
if config["combiner"]:
KeyError: 'combiner'`
I was using zsh in iTerm2. I then changed to the default Mac Terminal and was able to run it without issues.
**Environment:**
- OS: MacOS (Intel Macbook Pro)
**Reproduction Steps**
**Expected behavior**
I expected it to run properly.
**Screenshots**
**Contact Details**
Severity
Describe the bug I installed FedN into a conda environment using pip, to keep my base environment clean. I created a new folder containing the config.yaml and ran using
fedn run client -in client.yaml --secure=True --force-ssl
. A virtual environment was created, but I got an error message saying:`2024-10-02 14:34:28 [INFO] Running command: ['bash', '-c', 'source /Users/Admin/Documents/FedN/package/client/mnist-pytorch/bin/activate && python data.py ']
A module that was compiled using NumPy 1.x cannot be run in NumPy 2.1.1 as it may crash. To support both 1.x and 2.x versions of NumPy, modules must be compiled with NumPy 2.0. Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.
If you are a user of the module, the easiest solution will be to downgrade to 'numpy<2' or try to upgrade the affected module. We expect that some modules will need time to support NumPy 2.
Traceback (most recent call last): File "/Users/Admin/Documents/FedN/package/client/data.py", line 4, in
import torch
File "/Users/Admin/Documents/FedN/package/client/mnist-pytorch/lib/python3.12/site-packages/torch/init.py", line 1477, in
from .functional import # noqa: F403
File "/Users/Admin/Documents/FedN/package/client/mnist-pytorch/lib/python3.12/site-packages/torch/functional.py", line 9, in
import torch.nn.functional as F
File "/Users/Admin/Documents/FedN/package/client/mnist-pytorch/lib/python3.12/site-packages/torch/nn/init.py", line 1, in
from .modules import # noqa: F403
File "/Users/Admin/Documents/FedN/package/client/mnist-pytorch/lib/python3.12/site-packages/torch/nn/modules/init.py", line 35, in
from .transformer import TransformerEncoder, TransformerDecoder, \
File "/Users/Admin/Documents/FedN/package/client/mnist-pytorch/lib/python3.12/site-packages/torch/nn/modules/transformer.py", line 20, in
device: torch.device = torch.device(torch._C._get_default_device()), # torch.device('cpu'),
/Users/Admin/Documents/FedN/package/client/mnist-pytorch/lib/python3.12/site-packages/torch/nn/modules/transformer.py:20: UserWarning: Failed to initialize NumPy: _ARRAY_API not found (Triggered internally at /Users/runner/work/pytorch/pytorch/pytorch/torch/csrc/utils/tensor_numpy.cpp:84.)
device: torch.device = torch.device(torch._C._get_default_device()), # torch.device('cpu'),`
and
2024-10-02 14:43:15 [INFO] Client in TRAINING state. Traceback (most recent call last): File "/Users/Admin/Documents/FedN/package/client/train.py", line 77, in <module> train(sys.argv[1], sys.argv[2]) File "/Users/Admin/Documents/FedN/package/client/train.py", line 39, in train model = load_parameters(in_model_path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Admin/Documents/FedN/package/client/model.py", line 59, in load_parameters state_dict = collections.OrderedDict({key: torch.tensor(x) for key, x in params_dict}) ^^^^^^^^^^^^^^^ RuntimeError: Could not infer dtype of numpy.float32 2024-10-02 14:43:16 [INFO] Client in TRAINING state. 2024-10-02 14:43:16 [ERROR] Could not process training request due to error: Non-zero exit code: 1 Command: ['bash', '-c', 'source /Users/Admin/Documents/FedN/package/client/mnist-pytorch/bin/activate && python train.py /var/folders/qm/prmq9531019ff8d9k_81fljh0000gp/T/tmp3i49dw2t.npz /var/folders/qm/prmq9531019ff8d9k_81fljh0000gp/T/tmpeo3_8pq3.npz'] ^C2024-10-02 14:43:33 [INFO] Shutting down.
As prompted, I activated the virtual environment and installed
numpy<2
. I tried to join again and got the error:`Client configuration loaded from file: client.yaml Values set in file override defaults and command line arguments...
Traceback (most recent call last): File "/Users/Admin/Documents/FedN/package/client/mnist-pytorch/bin/fedn", line 8, in
sys.exit(main())
^^^^^^
File "/Users/Admin/Documents/FedN/package/client/mnist-pytorch/lib/python3.12/site-packages/click/core.py", line 1157, in call
return self.main(args, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Admin/Documents/FedN/package/client/mnist-pytorch/lib/python3.12/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/Users/Admin/Documents/FedN/package/client/mnist-pytorch/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Admin/Documents/FedN/package/client/mnist-pytorch/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Admin/Documents/FedN/package/client/mnist-pytorch/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Admin/Documents/FedN/package/client/mnist-pytorch/lib/python3.12/site-packages/click/core.py", line 783, in invoke
return __callback(args, *kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Admin/Documents/FedN/package/client/mnist-pytorch/lib/python3.12/site-packages/click/decorators.py", line 33, in new_func
return f(get_current_context(), args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Admin/Documents/FedN/package/client/mnist-pytorch/lib/python3.12/site-packages/fedn/cli/run_cmd.py", line 273, in client_cmd
client = Client(config)
^^^^^^^^^^^^^^
File "/Users/Admin/Documents/FedN/package/client/mnist-pytorch/lib/python3.12/site-packages/fedn/network/clients/client.py", line 83, in init
if config["combiner"]: