Can anyone give me a comprehensive guide to installing tensorflow-federated on M1 Mac?

789 Views Asked by At

i followed the instructions given by the official tf documentation, but i just cannot resolve the various problems encountered. Did anyone have the experience installing tff on m1 mac and can show me your overall process?

conda create -n federated python=3.8


conda activate federated

pip install --upgrade tensorflow_federated

everything seems to be fine according to the terminal output, however, after

import tensorflow_federated as tff

i got a RunTimeError:

RuntimeError: This version of jaxlib was built using AVX instructions, which your CPU and/or operating system do not support. You may be able work around this issue by building jaxlib from source.

how to resolve this?

1

There are 1 best solutions below

0
On

Install miniforge with Apple's arm64: Apple Silicon Method. Then, put it where Anaconda places its initialization code, that is in ~/zshrc.

This would make miniforge the default manager. Following which you need to create a ~/.start_anaconda.sh script so that Anaconda can be used as an alternative.

With miniforge,

  • Create a new conda environment mytraxenv with conda create -n mytraxenv python=3 which has your python version.
  • Activate the environment with conda activate mytraxenv
  • run conda install numpy and conda install six to ensure numpy.six and wheel in mytraxenv environment.
  • Then pip install -U pip pip install -U

Lastly follow these instructions to install pip install --upgrade pip pip install --upgrade "jax[cpu]"