0

I created a virtual environment like this

mkdir ai
cd ai
conda create --prefix ./env python=3.8
conda activate ./env

and installed libraries

brew install portaudio
pip install pyaudio

but an error was thrown

Collecting pyaudio
  Using cached PyAudio-0.2.12.tar.gz (42 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pyaudio
  Building wheel for pyaudio (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for pyaudio (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [16 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-11.0-arm64-cpython-310
      copying src/pyaudio.py -> build/lib.macosx-11.0-arm64-cpython-310
      running build_ext
      building '_portaudio' extension
      creating build/temp.macosx-11.0-arm64-cpython-310
      creating build/temp.macosx-11.0-arm64-cpython-310/src
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/premkumarsinha/miniforge3/include -arch arm64 -fPIC -O2 -isystem /Users/premkumarsinha/miniforge3/include -arch arm64 -DMACOSX=1 -I/usr/local/include -I/usr/include -I/Users/premkumarsinha/miniforge3/include/python3.10 -c src/_portaudiomodule.c -o build/temp.macosx-11.0-arm64-cpython-310/src/_portaudiomodule.o
      src/_portaudiomodule.c:31:10: fatal error: 'portaudio.h' file not found
      #include "portaudio.h"
               ^~~~~~~~~~~~~
      1 error generated.
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pyaudio
Failed to build pyaudio

So I ran this

brew find portaudio

and I got the dir for it;

/opt/homebrew/Cellar/portaudio/19.7.0

than I ran this command

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                               

But still I am getting the same error what should I do.

Shay
  • 15
  • 5

0 Answers0