Installing Tensor Flow on Mac OS (Read This)
If anyone is installing Tensor Flow on Mac OS running apple silicon and it's the year 2025+, you should read this. I installed TensorFlow according to the course instructions and everything worked fine until I got to the lesson where we train our network on the MNIST dataset. When I went to fit() the model, it hung indefinitely. It took hours of troubleshooting to determine the issue had nothing to do with the dataset or the code, but rather the install of TensorFlow.
Solution: Rather than install tensorflow, like the course describes, you need to install tensorflow-macos. There is a bunch of info about also needing to install tensorflow-metal to have it run on the GPU, but I didn't need that to fix the problem. You may gain some additional speed boosts, but you do not need it to fix the main problem of the indefinite hang.
I pray this helps someone avoid hours of effort!
-Justin
Solution: Rather than install tensorflow, like the course describes, you need to install tensorflow-macos. There is a bunch of info about also needing to install tensorflow-metal to have it run on the GPU, but I didn't need that to fix the problem. You may gain some additional speed boosts, but you do not need it to fix the main problem of the indefinite hang.
I pray this helps someone avoid hours of effort!
-Justin
2 answers ( 0 marked as helpful)
So apparently the modern way of working with tensorflow on the mac is to simply use tensorflow and tensorflow-metal rather than tensorflow-macos. BUT...i attempted this very thing this morning and ran into another nightmare of a time getting it work. There are all kinds of issues with different parts of the stack not working with one another - what you hear people call dependency hell.
I ultimately could not get the latest versions of things to work together properly:
Python 3.12
tensorflow 2.18.0
tensorflow-metal 1.1.0.
I personally could not get the normal install of tensorflow to work on the mac os with the version that supports metal. I had to bail and go back to tensorflow-macos.
So I tried this, which ultimately worked, but I had to fight through dependency issues with numpy and wrapt. The default numpy from pip was too new and the wrapt version was also wrong. But this did end up working for me:
Python 3.11
tensorflow-macos 2.15.0
tensorflow-metal 1.1.0
wrapt 1.14.1
numpy 1.25.2
I ultimately could not get the latest versions of things to work together properly:
Python 3.12
tensorflow 2.18.0
tensorflow-metal 1.1.0.
I personally could not get the normal install of tensorflow to work on the mac os with the version that supports metal. I had to bail and go back to tensorflow-macos.
So I tried this, which ultimately worked, but I had to fight through dependency issues with numpy and wrapt. The default numpy from pip was too new and the wrapt version was also wrong. But this did end up working for me:
Python 3.11
tensorflow-macos 2.15.0
tensorflow-metal 1.1.0
wrapt 1.14.1
numpy 1.25.2
To anyone walking down this path, my heart is with you. Stay strong, and after a fair amount of suffering, you too will get this to work!