-5

Mac M1 Can't Install PyAudio | Need Microphone for Google Speech Recognition:


Please note below I have outlined answers that have seemed to work for others that have not worked for me.


Below is the error code: WARNING: Discarding https://files.pythonhosted.org/packages/d0/dc/ffb9ce5e3f19bd289902915a9f68b7d199216065f8ea17d5b5e8e4ad86ee/PyAudio-0.2.9.tar.gz#sha256=bfd694272b3d1efc51726d0c27650b3c3ba1345f7f8fdada7e86c9751ce0f2a1 (from https://pypi.org/simple/pyaudio/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. Using cached pyaudio-0.2.8.tar.gz (235 kB) Preparing metadata (setup.py) ... error ERROR: Command errored out with exit status 1: command: /Library/Frameworks/Python.framework/Versions/3.10/bin/python3 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/lw/_gcm85s107z9sbgqyrw5pw700000gn/T/pip-install-p8wmnhcz/pyaudio_38ac896d11214f37bec552d23eaf6dfc/setup.py'"'"'; file='"'"'/private/var/folders/lw/_gcm85s107z9sbgqyrw5pw700000gn/T/pip-install-p8wmnhcz/pyaudio_38ac896d11214f37bec552d23eaf6dfc/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/lw/_gcm85s107z9sbgqyrw5pw700000gn/T/pip-pip-egg-info-nt0b4dbj cwd: /private/var/folders/lw/_gcm85s107z9sbgqyrw5pw700000gn/T/pip-install-p8wmnhcz/pyaudio_38ac896d11214f37bec552d23eaf6dfc/ Complete output (15 lines): Traceback (most recent call last): File "", line 1, in File "/private/var/folders/lw/_gcm85s107z9sbgqyrw5pw700000gn/T/pip-install-p8wmnhcz/pyaudio_38ac896d11214f37bec552d23eaf6dfc/setup.py", line 124, in setup(name = 'PyAudio', File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/distutils/core.py", line 121, in setup dist.parse_config_files() File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/dist.py", line 776, in parse_config_files self._parse_config_files(filenames=filenames) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/dist.py", line 648, in _parse_config_files parser.read_file(reader) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/configparser.py", line 719, in read_file self._read(f, source)


WARNING: Discarding https://files.pythonhosted.org/packages/06/d1/3d202c9187fb78ad6d4f8b476a8cc0ded7c1b47ca33d5dab73b959faf123/pyaudio-0.2.8.tar.gz#sha256=4f85367cf79657616684487037957ac38582ecc5389b89420fe61d901b719551 (from https://pypi.org/simple/pyaudio/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. ERROR: Could not find a version that satisfies the requirement pyaudio (from versions: 0.2.8, 0.2.9, 0.2.10, 0.2.11) ERROR: No matching distribution found for pyaudio WARNING: You are using pip version 21.3; however, version 21.3.1 is available. You should consider upgrading via the '/Library/Frameworks/Python.framework/Versions/3.10/bin/python3 -m pip install --upgrade pip' command.


Please note what was attempted through answers on stackoverflow and other-sites that has not worked for me.


brew update brew install portaudio brew link --overwrite portaudio pip install pyaudio


##Use the command to install PortAudio

sudo brew install portaudio

##After successful installation of PortAudio, enter the following command.

sudo nano $HOME/.pydistutils.cfg

##Next, enter the following lines in the opened window

[build_ext] include_dirs=/Users//homebrew/Cellar/portaudio/19.20140130/include/ include_dirs=/Users//homebrew/Cellar/portaudio/19.20140130/lib/

Finally run the command

pip install pyaudio

or

pip3 install pyaudio


Any help would be greatly appreciated. Thank you.

OHP
  • 111
  • 8
  • https://stackoverflow.com/search?q=%5Bpip%5D+fatal+error+portaudio.h+file+not+found – phd Oct 26 '21 at 10:28

1 Answers1

1

install brew on your M1 machine from here

How to install homebrew on M1 mac

And then enter this commands :

brew update
brew install portaudio
brew link --overwrite portaudio
pip install pyaudio

you can also check this :

Unable to install PyAudio on M1 Mac [PortAudio already installed]

Freeman
  • 9,464
  • 7
  • 35
  • 58
  • Freeman thank you for the suggestion. Did everything you suggested and still getting the error. Below is the exact response from the actions you listed. – OHP Oct 27 '21 at 16:21
  • user@MacBook-Air ~ % brew update Updated 2 taps (homebrew/core and homebrew/cask). – OHP Oct 27 '21 at 16:22
  • user@MacBook-Air ~ % brew install portaudio Warning: portaudio 19.7.0 is already installed and up-to-date. To reinstall 19.7.0, run: brew reinstall portaudio – OHP Oct 27 '21 at 16:23
  • user@MacBook-Air ~ % brew link --overwrite portaudio Warning: Already linked: /opt/homebrew/Cellar/portaudio/19.7.0 To relink, run: brew unlink portaudio && brew link portaudio – OHP Oct 27 '21 at 16:23
  • user@MacBook-Air ~ % pip install pyaudio – OHP Oct 27 '21 at 16:24
  • Still shooting the exact same error – OHP Oct 27 '21 at 16:25
  • that's ok @OHP, just run step by step like me : (1) brew reinstall portaudio – Freeman Oct 28 '21 at 06:13
  • (2) brew unlink portaudio && brew link portaudio – Freeman Oct 28 '21 at 06:13
  • (3) pip install pyaudio – Freeman Oct 28 '21 at 06:14
  • after this steps if it shows you any error send it to me again , thnx – Freeman Oct 28 '21 at 06:15
  • Last login: Wed Oct 27 23:54:56 on ttys002 user@MacBook-Air ~ % pip install pyaudio ERROR: Could not find a version that satisfies the requirement pyaudio (from versions: 0.2.8, 0.2.9, 0.2.10, 0.2.11) ERROR: No matching distribution found for pyaudio – OHP Oct 28 '21 at 07:05
  • Thanks @Freeman want to send you the whole error code "sent you the end, but it is a long one" , but don't know how, a little new to this appreciate the help. – OHP Oct 28 '21 at 07:06
  • WARNING: Discarding https://files.pythonhosted.org/packages/06/d1/3d202c9187fb78ad6d4f8b476a8cc0ded7c1b47ca33d5dab73b959faf123/pyaudio-0.2.8.tar.gz#sha256=4f85367cf79657616684487037957ac38582ecc5389b89420fe61d901b719551 (from https://pypi.org/simple/pyaudio/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. – OHP Oct 28 '21 at 07:07
  • Don't know if this matters, however, ran: – OHP Oct 28 '21 at 07:08
  • brew doctor and received this message – OHP Oct 28 '21 at 07:09
  • Warning: A '.pydistutils.cfg' file was found in $HOME, which may cause Python builds to fail. See: https://bugs.python.org/issue6138 https://bugs.python.org/issue4655 – OHP Oct 28 '21 at 07:09
  • where r u from ? and do you have anydesk ? – Freeman Oct 28 '21 at 07:31