Can't install tensorflow-metal on M3 Apple Silicon

Tried various how-tos on youtube and github. Have conda.
Third step fails.

conda install -c apple tensorflow-deps

pip install tensorflow-macos

pip install tensorflow-metal

ERROR: Could not find a version that satisfies the requirement tensorflow-metal (from versions: none)

ERROR: No matching distribution found for tensorflow-metal

I see a lot of fixes for Intel-based Mac. None for M3. HELP!?

  • Also note following version info:

    Macos 14.4.1, ARM64tf.version = 2.16.1python=3.9

    Although I've tried python 3.12, 3.10, 3.8.

Add a Comment

Accepted Reply

I was getting the same error. I figured that this was because after I created a new conda environment for TensorFlow, I began by running conda install python to get the latest python version on the environment. My successful attempt was when I didn't install Python and went straight ahead with Step 1, "conda install -c apple tensorflow-deps" after creating the environment.

Step 1: Install TensorFlow dependencies from Apple Conda channel.

conda install -c apple tensorflow-deps

Step 2: Install base TensorFlow (Apple's fork of TensorFlow is called tensorflow-macos).

python -m pip install tensorflow-macos

Step 3: Install Apple's tensorflow-metal to leverage Apple Metal (Apple's GPU framework) for M1, M1 Pro, M1 Max GPU acceleration.

python -m pip install tensorflow-metal

  • It works on my m1 macbook pro.

Add a Comment

Replies

Conda has difficulty identifying the OS. Type this command at the command line prior to running the pip command. export SYSTEM_VERSION_COMPAT=0

  • When you say Conda, are you referring to Anaconda or MiniConda? I understand they have some differing behavior around OS or Apple Metal.

Add a Comment

I was getting the same error. I figured that this was because after I created a new conda environment for TensorFlow, I began by running conda install python to get the latest python version on the environment. My successful attempt was when I didn't install Python and went straight ahead with Step 1, "conda install -c apple tensorflow-deps" after creating the environment.

Step 1: Install TensorFlow dependencies from Apple Conda channel.

conda install -c apple tensorflow-deps

Step 2: Install base TensorFlow (Apple's fork of TensorFlow is called tensorflow-macos).

python -m pip install tensorflow-macos

Step 3: Install Apple's tensorflow-metal to leverage Apple Metal (Apple's GPU framework) for M1, M1 Pro, M1 Max GPU acceleration.

python -m pip install tensorflow-metal

  • It works on my m1 macbook pro.

Add a Comment

Thanks for these replies! I'll try them both today or tomorrow.

I was able to get a fresh install to work on a different MacBook Air M2. Although simple tf/keras/gpu test scripts required several edits to even run and display versions and available devices!

I've seen a comment on yt that the reason I can't find answers is because M3 users likely prefer the apple mlx libraries over tensorflow due to unified memory support. Thoughts?

Well, I finally got it to install. I'm not sure what made it work, but I did some things:

  • Removed Python 3.12 and install 3.11.9
  • Added parameters to .condarc file:
channels:
  - apple
  - conda-forge
  - defaults
subdirs:
  - osx-arm64
  - osx-64
  - noarch
  • Reran the 3 steps above. Note that the tensorflow_deps still threw an error but the rest worked!
  • Reran the config test below, which now shows GPU present!
>>> tf.__version__
'2.16.1'
>>> tf.config.list_physical_devices()
[PhysicalDevice(name='/physical_device:CPU:0', device_type='CPU'), PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]