I am trying to install pyaudio on my new Macbook Air with the M1 chip (Big Sur). At first I couldn't get past the famous src/_portaudiomodule.c:29:10: fatal error: 'portaudio.h' file not found
error. I remember I had this issue on my other laptop as well, but then a simple brew install portaudio
fixed it. Well, not this time.
After trying a lot of different things, finally I found this guide and after finding my homebrew directory, I could do:
export LIBRARY_PATH=/opt/homebrew/lib/:$LIBRARY_PATH
- same with C_INCLUDE
After I did this, pyaudio installed fine! However, now I'm getting an error when I try to import pyaudio to any python program and run it:
Traceback (most recent call last):
File "/Users/bende/GitHub/fretboard-learner/main.py", line 5, in <module>
import pyaudio
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyaudio.py", line 116, in <module>
import _portaudio as pa
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/_portaudio.cpython-39-darwin.so, 2): Symbol not found: _PaMacCore_SetupChannelMap
Referenced from: /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/_portaudio.cpython-39-darwin.so
Expected in: flat namespace
in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/_portaudio.cpython-39-darwin.so
I tried googling it but to no avail, I'm really not sure what is happening. All I can think of is that it has to do something with the M1 chip, because the install worked just fine on a non-M1 mac.
Does anyone have any idea what could be causing this?