Installation Mac M1


I am new in Nengo and I can’t find a good way to install it on my Mac M1.
I tried to create an environnement (anaconda) with tensorflow and I could install keras_spiking.

However whenever I try to import it and to run the code there: Classifying Fashion MNIST with spiking activations — KerasSpiking 0.3.1.dev0 docs

the kernel dies. Do you have an idea how could I do?
Did someone could install Nengo and run the above code on its mac?

Thanks in advance,


Hey Maxime,

I’ve initially had issues with installing keras-spiking on my Apple Silicon machine using a virtual environment and pip install keras-spiking. This is due to the fact that tensorflow-macos is not recognized as tensorflow. Thus, I had to create a temporal workaround (see).

After changing the (see above PR), my procedure was:

python3 -m venv ./venv # creates the virtual environment in the current project folder
source venv/bin/activate # activates the venv
pip install tensorflow-macos # installs Apple Silicon-compatible tensorflow package
pip install tensorflow-metal # GPU support for Apple Silicon chips 
pip install -e /path/to/keras-spiking # installs local copy of keras-spiking repo with adjusted

Now you can simply import the packages in your .py file as usual:

import tensorflow as tf
import keras_spiking

That’s how I got the Jupyter notebook running on my M1 machine. However, as you’re using anaconda you may face another issue. If you have any further questions, please reach out :slight_smile:

Hello and thanks for your help,

I tried to follow your steps and used venv instead of conda.
However, when I am running the last install:

pip install -e /path/to/keras-spiking # installs local copy of keras-spiking repo with adjusted

I got this error cause it does not find tensorflow as I installed tensorflow-macos and tensorflow-metal but not the simple tensorflow:

(keras_spiking_env) (base) mc@87-77-197-239 Code % pip install -e /Users/mc/Documents/PhD/Code/keras-spiking

Obtaining file:///Users/mc/Documents/PhD/Code/keras-spiking

Installing build dependencies ... done

Checking if build backend supports build_editable ... done

Getting requirements to build editable ... done

Preparing editable metadata (pyproject.toml) ... done

Requirement already satisfied: packaging>=20.0 in ./keras_spiking_env/Users/mc/Documents/PhD/Code/keras_spiking_env/lib/python3.9/site-packages (from keras-spiking==0.3.1.dev0) (23.0)

Requirement already satisfied: numpy>=1.16.0 in ./keras_spiking_env/Users/mc/Documents/PhD/Code/keras_spiking_env/lib/python3.9/site-packages (from keras-spiking==0.3.1.dev0) (1.24.1)

ERROR: Could not find a version that satisfies the requirement tensorflow>=2.1.0 (from keras-spiking) (from versions: none)

ERROR: No matching distribution found for tensorflow>=2.1.0

WARNING: You are using pip version 22.0.4; however, version 22.3.1 is available.

You should consider upgrading via the '/Users/mc/Documents/PhD/Code/keras_spiking_env/Users/mc/Documents/PhD/Code/keras_spiking_env/bin/python3 -m pip install --upgrade pip' command.

How did you overcome this problem? Did you change the code from keras_spiking to make it run directly on tensorflow-metal?

(And I can’t install the simple tensorflow as it does not work properly on Mac M1)

thanks in advance for your help,



Hey Maxime,

yes, please check out my PR on GitHub to see the changes I’ve made in After you’ve applied the changes, tensorflow-macos will be recognized by the setup.

And yes, I agree - pip install tensorflow should automatically install the correct version for Apple Silicon machines. Unfortunately, that’s not up to us :confused: (the issue is already known, follow the discussion i.e. here)

If you need any more help, please let me know.