01 icon indicating copy to clipboard operation
01 copied to clipboard

PyAudio ImportError: symbol not found in flat namespace '_PaMacCore_SetupChannelMap'

Open matmult opened this issue 1 year ago • 4 comments

Running on M2 MBP in a conda environment.

To reproduce, 1) create conda env with python=3.10 2) brew install requirements 3) pip install 01OS 4) run 01.

This could be a conda/arm architecture issue, see relevant stackoverflow: https://stackoverflow.com/questions/69909054/could-not-import-the-pyaudio-c-module-portaudio-mac-m1-about-symbol-not-f

matmult avatar Mar 03 '24 19:03 matmult

This is an issue with one or both of:

  1. your brew (and hence portaudio) installation
  2. your pyaudio installation

First, uninstall pyaudio and portaudio, then try to follow this answer to see if it works.

If it doesn't, you may need to reinstall Brew:

Brew is installed in /usr/local in older Intel / Rosetta Macs, but installs in /opt/homebrew now. You can use which brew to find out where brew is installed. Incase it is still on /usr/local, you'll need to uninstall brew from there and install in /opt/homebrew, since Pyaudio will also pick it up from there. Follow these steps to fix Brew.

Once brew is fixed, uninstall pyaudio, then reinstall it using the Stackoverflow link.

shivenmian avatar Mar 03 '24 22:03 shivenmian

Thanks for the response. I found out that there were old portaudio files in /usr/local/include from intel->arm migration and removed those.

brew install portaudio seems to install it in /opt/homebrew/Cellar/portaudio/19.7.0, and I built pyaudio with pip install --global-option='build_ext' --global-option='-I/opt/homebrew/Cellar/portaudio/19.7.0/include' --global-option='-L/opt/homebrew/Cellar/portaudio/19.7.0/lib' pyaudio.

Sadly, the issue still persists.

matmult avatar Mar 04 '24 20:03 matmult

unfortunately running into similar issues on m1 pro, tried the above suggestions to no avail

keldenl avatar Mar 22 '24 04:03 keldenl

sudo apt-get update
sudo apt-get install portaudio19-dev

@keldenl this worked for ubuntu for me, you can try similar and might just work

shahdivax avatar Mar 24 '24 14:03 shahdivax

i was actually able to fix this issue another way – setting up my own conda env (make sure to do python version 3.11.8, due to another issue):

CONDA_SUBDIR=osx-arm64 conda create -n MY_ENV python python=3.11.8

and then thanks to https://stackoverflow.com/questions/33513522/when-installing-pyaudio-pip-cannot-find-portaudio-h-in-usr-local-include/69833329#69833329

conda activate
poetry install
pip uninstall pyaudio
pip install --global-option='build_ext' --global-option="-I$(brew --prefix)/include" --global-option="-L$(brew --prefix)/lib" pyaudio

and then running it with --local did the trick!

keldenl avatar Mar 26 '24 04:03 keldenl

Seems like this is sorted out now, thanks @shahdivax, @keldenl and @shivenmian for your help!

tyfiero avatar Mar 28 '24 21:03 tyfiero

I am still not sort this out using you guys mentioned solutions.. But I first import sounddevice and then import pyaudio. This works! Maybe the portaudio is linked by the sounddevice, and then the pyaudio package works. Im using m1pro chip btw.

Linfeng1505 avatar Jul 01 '24 03:07 Linfeng1505

I'm using a conda environment and this works for me:

conda install pyaudio

btilongnguyen avatar Oct 01 '24 02:10 btilongnguyen

conda update --all conda install pyaudio works on m3

ycchuang avatar Dec 19 '24 07:12 ycchuang