[Python] Unable to install tensorflow-federated on M2 Macbook

Discussão em 'Python' iniciado por Stack, Fevereiro 9, 2025.

  1. Stack

    Stack Membro Participativo

    I am currently facing a really frustrating problem with installing tensorflow federated. I am on M2 Macbook Air, using virtual env, no conda.

    I was following this tutorial, and did the following:

    1. Created a new folder
    2. Set the local Python versoion to: pyenv local 3.13.2
    3. Created a new environment with: python -m venv tff-venv
    4. Upgraded pip with: pip install --upgrade "pip"
    5. Tried to install tensorflow federated with: pip install --upgrade tensorflow-federated

    I got this error:

    Collecting absl-py~=0.9.0 (from tensorflow-federated)
    Using cached absl-py-0.9.0.tar.gz (104 kB)
    Installing build dependencies ... done
    Getting requirements to build wheel ... error
    error: subprocess-exited-with-error

    × Getting requirements to build wheel did not run successfully.
    ....
    ....
    File "<string>", line 34, in <module>
    RuntimeError: Python version 2.7 or 3.4+ is required.
    [end of output]


    After that I googled a bit, and found out that the package apparently thinks that python 3.13 is less than 3.4, because it compares string.

    Thus, I deleted the venv, and then set the local python version to 3.9.15 (Step 2) and followed the rest of the steps. However, I again got an error while trying to pip install tensorflow-federated:

    ...
    ModuleNotFoundError: No module named 'distutils.msvccompiler'
    ...


    Thus, I am bit stuck as I have no clue what could be wrong and how I could fix it. I would be grateful for any help!

    Continue reading...

Compartilhe esta Página