I encountered a problem that I haven’t seen before, and suddenly I can’t use ‘import nengo_loihi’ in python today. I get ‘zsh: illegal hardware instruction’ when I add it to the file. But the nengo library can still be used. This may have something to do with the nengo_dl I downloaded with pip3 yesterday. But unfortunately nengo_loihi and nengo_dl are not available now. I would be grateful if someone could give me some advice or help?
The editor I use is vs code, and the computer is a MAC with an M1 chip.
Hi @lry, and welcome to the Nengo forums!
Unfortunately, I don’t have an M1 macbook available to test, but I have some suggestions for you to try:
- If you are using the built in Python environment (the one that came with your Mac), I suggest installing Miniconda or Anaconda. Miniconda is a lightweight version of Anaconda, and both allow you to create separate instances of Python environments where each one can be configured specifically for different projects (or in this case, to debug Python packages)
- If you are already using Conda, then create a new Python environment, and
pip install nengo(and test), then
pip install nengo-dl(and test), and finally
pip install nengo-loihi(and test).
- I suspect that TensorFlow might be the root cause of this issue (in fact, a google reveals this issue on Github), so removing NengoDL and the TensorFlow Python package should also fix this issue. Doing a search does provide multiple solutions to getting TensorFlow working on an M1 mac (from setting the
archarchitecture flag on Python, to installing the
tensorflow-macosversion, to using
tensorflow-metal, to compiling TensorFlow from source), but without an M1 to test myself, I cannot tell you exactly which steps will definitely work on your machine.