Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
matmult opened this issue Mar 3, 2024 · 7 comments

Comments

@matmult
Copy link

matmult commented Mar 3, 2024

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

@shivenmian
Copy link
Collaborator

shivenmian commented Mar 3, 2024

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.

@matmult
Copy link
Author

matmult commented Mar 4, 2024

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.

@keldenl
Copy link

keldenl commented Mar 22, 2024

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

@shahdivax
Copy link

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

@keldenl
Copy link

keldenl commented Mar 26, 2024

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!

@tyfiero
Copy link
Collaborator

tyfiero commented Mar 28, 2024

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

@tyfiero tyfiero closed this as completed Mar 28, 2024
@Linfeng1505
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants