How to get pip install to find the portaudio.h header file?

I am trying to install deepspeech and to use the mic input it depends on pyaudio which depends on portaudio.h. But even after installing portaudio by adding it to the system packages in configuration.nix, I get the error saying:

fatal error: portaudio.h: No such file or directory

How can I install pyaudio and portaudio?

I looked online and I found this but it doesn’t work because nix works differently and the header files are not stored in usr/include:

pip install --global-option='build_ext' --global-option='-I/usr/local/include' --global-option='-L/usr/local/lib' pyaudio

Can someone help me understanding how this can be solved?

Please don’t use pip, instead package the thing you want to install.

Hi, could you explain what you mean by package? and can you link me to some guides on how to do that if that is not too much of a trouble?

I mean you have to write a derivation (aka a “package”) of the thing you want to use, if its not already in nixpkgs.

Nixpkgs 23.11 manual | Nix & NixOS bives you bit of an overview.

1 Like

Ah, This might take me a while to read and implement and make things work. But Thank you for this! This guide will help a lot!

Looks like it’s already packaged though under the name stt: