Attempts to install Tensorflow on Mac Studio M1 fail

I am attempting to install Tensorflow on my M1 and I seem to be unable to find the correct matching versions of jax, jaxlib and numpy to make it all work.

I am in Bash, because the default shell gave me issues.

I downgraded to python 3.10, because with 3.13, I could not do anything right.

Current actions:

bash-3.2$ python3.10 -m venv ~/venv-metal
bash-3.2$ python --version
Python 3.10.16

python3.10 -m venv ~/venv-metal
source ~/venv-metal/bin/activate
python -m pip install -U pip

python -m pip install tensorflow-macos

And here, I keep running tnto errors like: (venv-metal):~$ pip install tensorflow-macos tensorflow-metal

ERROR: Could not find a version that satisfies the requirement tensorflow-macos (from versions: none)
ERROR: No matching distribution found for tensorflow-macos

What is wrong here? How can I fix that?

It seems like the system wants to use the x86 version of python ... which can't be right.

There is one way I seem to have gotten this to work ...

brew install python@3.9
python3.9 -m venv venv-metal-39
source venv-metal-39/bin/activate
pip install tensorflow-macos==2.12.0 tensorflow-metal==0.7.0
python -c "import tensorflow as tf; print(tf.__version__)"

But why does macOS insist on using the x86 version of python? And Why can I not use python 3.13 for this ... and install an old version like 3.9? (also 3.10 fails) ... and an old version of tensorflow.

You're right, those python libs tensorflow-* are not marked as compatible with newer pythons.

That python3.9 is not necessarily x86 though - you can check it:

python3.9
import platform
platform.machine()

Thanks @emmtee! But I think the speed benefits of running native on M1 (in stead of slightly older versions on Rosetta) outweighs the desire to use the latest ...

Hello, I am new here and also new as "Dev". In fact I started working as MLOps, so please take care of me.. . For the investigations that I had done, tensorflow-macos is not needed anymore. You have to install usual TensorFlow (with versions restrictions below).

  • NOTE: the latest tensorflow-metal, v1.1.0, it is from September 2023!

I have it installed and working, through experimentation with:

  • Python 3.11 (it should be 3.10, but I have tested 3.11 works. 3.12 and 3.13 does NOT work)
  • requirements.txt

tensorflow==2.17.1 tensorflow-metal==1.1.0 tf_keras==2.17.0

I hope you manage get it working. This could be change if somebody (Apple?) release a new version that could be compatible with Python 3.12 and Tensorflow 2.18...

Regards!

Attempts to install Tensorflow on Mac Studio M1 fail
 
 
Q