AstroNN is a lovely Python package for applying deep learning to astronomy — stellar spectra, Gaia data, the works. Getting it and TensorFlow running on Apple Silicon took some fiddling; here's the setup that finally worked.

The problem

Stock TensorFlow wheels don't target the M-series GPU, so a naive pip install tensorflow either fails to build or runs CPU-only and slow. The fix is Apple's tensorflow-metal plugin on top of tensorflow-macos.

The recipe

conda create -n astronn python=3.10
conda activate astronn
pip install tensorflow-macos tensorflow-metal
pip install astroNN

Keep Python at 3.10 — newer versions raced ahead of the metal plugin's support matrix when I set this up. After that, tf.config.list_physical_devices('GPU') shows the device and models train on the GPU.

Worth it?

For experimenting with pretrained astro models on a laptop, absolutely — no cloud GPU bill, and the M-series chips are no slouch.