amazon-nova-samples icon indicating copy to clipboard operation
amazon-nova-samples copied to clipboard

(S2S sample-codes/console-python) fatal error: 'portaudio.h' file not found

Open athewsey opened this issue 10 months ago • 1 comments

When trying to pip install as described in speech-to-speech/sample-codes/console-python, I'm getting the following error:

        self._finalize_license_expression()
      running bdist_wheel
      running build
      running build_py
      creating build/lib.macosx-11.0-arm64-cpython-313/pyaudio
      copying src/pyaudio/__init__.py -> build/lib.macosx-11.0-arm64-cpython-313/pyaudio
      running build_ext
      building 'pyaudio._portaudio' extension
      creating build/temp.macosx-11.0-arm64-cpython-313/src/pyaudio
      cc -fno-strict-overflow -Wsign-compare -Wunreachable-code -DNDEBUG -g -O3 -Wall -arch arm64 -mmacosx-version-min=11.0 -Wno-nullability-completeness -Wno-expansion-to-defined -Wno-undef-prefix -fPIC -DMACOS=1 -I/usr/local/include -I/usr/include -I/opt/homebrew/include -I/{...}/amazon-nova-samples/speech-to-speech/sample-codes/console-python/.venv/include -I/Users/{me}/.local/share/mise/installs/python/3.13.1/include/python3.13 -c src/pyaudio/device_api.c -o build/temp.macosx-11.0-arm64-cpython-313/src/pyaudio/device_api.o
      src/pyaudio/device_api.c:9:10: fatal error: 'portaudio.h' file not found
          9 | #include "portaudio.h"
            |          ^~~~~~~~~~~~~
      1 error generated.
      error: command '/usr/bin/cc' 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
  Building wheel for ijson (pyproject.toml) ... done
  Created wheel for ijson: filename=ijson-3.3.0-py3-none-any.whl size=29897 sha256=bcfdac858594169c4c8204f3e18ad6695c4bae1131368b344553d643e7d44645
  Stored in directory: /Users/{me}/Library/Caches/pip/wheels/54/e2/c7/ea0ff2f325d164220e9e6c1c830890538f530c88069345ab15
Successfully built ijson
Failed to build pyaudio

[notice] A new release of pip is available: 24.3.1 -> 25.0.1
[notice] To update, run: pip install --upgrade pip
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (pyaudio)

From this StackOverflow answer, it seems like installing portaudio is a required pre-requisite that isn't mentioned in the README? Verified that running brew install portaudio fixes the issue, so we should probably document this.

Observed on MacOS 15.3 (M2 Pro chip)

athewsey avatar Apr 09 '25 03:04 athewsey

I'm seeing the same problem, currently using Python 3.13.3, Using M3.

shauwang avatar May 03 '25 21:05 shauwang