Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not import the PyAudio C module '_portaudio'. (Mac M1), about Symbol not found: _PaMacCore_SetupChannelMap

I'm trying to import pyaudio on my Macbook with M1 chip. I have python version 3.9.6 and anaconda (python 3.8), and now using version on terminal is 3.9.6.

Before I get this error, I fixed 'brew install portaudio' & 'pip install pyaudio' problem. Portaudio & Pyaudio installed fine! But when I try to import pyaudio,

Could not import the PyAudio C module '_portaudio'.
Traceback (most recent call last):
  File "/Users/hson/Desktop/k.A.I_speaker/test.py", line 2, in <module>
    import make_pyaudio
  File "/Users/hson/Desktop/k.A.I_speaker/make_pyaudio.py", line 1, 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 uninstall portaudio&pyaudio and reinstall many times, but still I could not fix this problem.

Does anyone who get this problem and fix it?

like image 677
hson Avatar asked Sep 18 '25 11:09

hson


1 Answers

"conda install portaudio pyaudio" worked on my m1 mac

like image 60
Yangjiong Zhang Avatar answered Sep 21 '25 02:09

Yangjiong Zhang