NVIDIA / NVFlare

NVIDIA Federated Learning Application Runtime Environment
https://nvidia.github.io/NVFlare/
Apache License 2.0
596 stars 170 forks source link

AttributeError: module 'cryptography.hazmat.primitives.serialization' has no attribute 'pkcs12' #2760

Closed dvellanki closed 3 weeks ago

dvellanki commented 1 month ago

I tried using the version 2.4.1_no_xgb as suggested in this thread [https://github.com/NVIDIA/NVFlare/discussions/2741], but I still get the same issue when running the nvflare poc prepare command. Any suggestions?

Here is how the pull is happening from the docker file ARG NVF_VERSION=2.4.1_no_xgb RUN git clone https://github.com/NVIDIA/NVFlare.git --branch ${NVF_BRANCH} --single-branch NVFlare

Error: File "/usr/local/lib/python3.8/dist-packages/nvflare/lighter/spec.py", line 174, in provision b.build(project, ctx) File "/usr/local/lib/python3.8/dist-packages/nvflare/lighter/impl/cert.py", line 137, in build self._build_write_cert_pair(server, "server", ctx) File "/usr/local/lib/python3.8/dist-packages/nvflare/lighter/impl/cert.py", line 119, in _build_write_cert_pair pkcs12 = serialization.pkcs12.serialize_key_and_certificates( AttributeError: module 'cryptography.hazmat.primitives.serialization' has no attribute 'pkcs12'

parkeraddison commented 1 month ago

We faced the same thing. You can downgrade your cryptography package to 42.0.8 and it'll work again.

YuanTingHsieh commented 1 month ago

@dvellanki thanks for raising this issue here, we will be updating our 2.4 to have this fix later for the public version.

If you use 2.4.1_no_xgb branch that should work correctly, do you mind sharing how you setup or how you run your experiment, it could be that in the middle of it, you install another version of NVFlare.

Another way as @parkeraddison suggested, you can downgrade your cryptography package for now.

dvellanki commented 1 month ago

Thank you for the suggestions @YuanTingHsieh @parkeraddison . I will try downgrading the crypto version and see what happens. Meanwhile, here is my docker file for the xgb version that doesnt work for me.

ARG NVF_VERSION=2.4.1_no_xgb ENV NVF_BRANCH=${NVF_VERSION} ENV PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python

RUN pip install nvflare

WORKDIR /workspace/ RUN git clone https://github.com/NVIDIA/NVFlare.git --branch ${NVF_BRANCH} --single-branch NVFlare

WORKDIR /workspace/NVFlare

dvellanki commented 1 month ago

An update - downgrading the crypto version worked like a charm. Thank You!!

YuanTingHsieh commented 3 weeks ago

solved by #2721 and #2746