PyAudio@0.2.14 available to install under 'Packages' in Python, results in "Couldn't install package. See console for details ... "

Problem description

Is it safe to assume that if a package is available to install, it would be a bug if it doesn’t? :slight_smile: Because I don’t know system engineering or whatever it’s called, i worry about bothering you guys with something that’s not truly a bug - but I balanced that concern with the fact that you guys mentioned that if there’s really a bug you’d really like to know about it so you can fix it. Because I did the following before posting this, it SEEMS more likely than not to be a bug? But I am not sure. It should be easy for you guys to replicate though, so hopefully it won’t take you long to see what i am seeing. Thanks for your help!
Things I tried to get it to work:

  • pip install pyaudio
  • asked Replit AI for help (followed all the suggestions, and we couldn’t get it to work)
  • asked ChatGPT4 for help (followed all the suggestions, and we couldn’t get it to work)
  • tried two different browsers, just to be sure:
    • Google Chrome Version 123.0.6312.124 (Official Build) (64-bit)
    • Microsoft Edge Version 124.0.2478.51 (Official build) (64-bit)
  • wanted to try adding portaudio manually, but wasn’t sure how

Expected behavior

I would like to be able to install pyaudio (so I can use the speech recognition package to get user input from a microphone).
Here’s the link to a fresh page where I was able to replicate the problem after opening up a new Python repl:
Hopefully (or not hopefully??) you will be able to reproduce it?

Actual behavior

Here is what showed up in the console after the install didn’t complete (I tried pip wheel --use-pep517 "pyaudio (==0.2.14)", like it recommends at the end and got a whole other error message in the shell :o)

--> poetry add 'PyAudio ==0.2.14'

Updating dependencies
Resolving dependencies...

Package operations: 1 install, 0 updates, 0 removals

  • Installing pyaudio (0.2.14)


  Backend subprocess exited when trying to invoke build_wheel
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-cpython-310
  creating build/lib.linux-x86_64-cpython-310/pyaudio
  copying src/pyaudio/ -> build/lib.linux-x86_64-cpython-310/pyaudio
  running build_ext
  building 'pyaudio._portaudio' extension
  creating build/temp.linux-x86_64-cpython-310
  creating build/temp.linux-x86_64-cpython-310/src
  creating build/temp.linux-x86_64-cpython-310/src/pyaudio
  gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -I/nix/store/9109gq5pbiizq4jf8qcyrdxcc15chcr5-libxcrypt-4.4.36/include -fPIC -I/usr/local/include -I/usr/include -I/tmp/tmpuqiduncp/.venv/include -I/nix/store/1gc9wvzsy15pclrqfspii166p52lmh5i-python3-3.10.13/include/python3.10 -c src/pyaudio/device_api.c -o build/temp.linux-x86_64-cpython-310/src/pyaudio/device_api.o
  src/pyaudio/device_api.c:9:10: fatal error: portaudio.h: No such file or directory
      9 | #include "portaudio.h"
        |          ^~~~~~~~~~~~~
  compilation terminated.
  error: command '/nix/store/lpmc13klbgrfbc87ahf14rhv6y78chxz-replit-runtime-path/bin/gcc' failed with exit code 1

  at /nix/store/kl8q9n461fq93wvsxi7lrm3if9diax6l-poetry-in-venv/env/lib/python3.10/site-packages/poetry/installation/ in _prepare
      144│                 error = ChefBuildError("\n\n".join(message_parts))
      146│             if error is not None:
    → 147│                 raise error from None
      149│             return path
      151│     def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:

Note: This error originates from the build backend, and is likely not a problem with poetry but with pyaudio (0.2.14) not supporting PEP 517 builds. You can verify this by running 'pip wheel --use-pep517 "pyaudio (==0.2.14)"'.

exit status 1

Steps to reproduce

  1. Create a new Python REPL
  2. Click on Packages
  3. Search for ‘pyaudio’
  4. Click ‘install’ for PyAudio@0.2.14 (Cross-platform audio I/O with PortAudio)




Windows 11 Home

Device if mobile



Core membership

Please upload screenshots


@ErikaWang1 Thank you for the detailed description and we received your private ticket as well. I agree it does seem like a bug. I’ll be communicating with you primarily through the ticket, but I’ll also update here once we identify workarounds or a resolution.

1 Like

@ErikaWang1 I was able to sync with the team. We have a fix upcoming for this issue, but in the meantime, can you execute the following command in the shell as a workaround?

nix-editor --add pkgs.portaudio

It should manually add the dependency to allow for PyAudio.

1 Like

Hi Suzy!

Sorry for taking so long to get back to you - i forgot my account is attached to a different email from my normal account! :woman_facepalming:t2:

Will give it a try, and let you know how it goes - thank you so much for all the help! :slightly_smiling_face::wave::crossed_fingers:

Cheers, Erika :tulip:

1 Like