1

If I try installing PyAudio 2.11 using

python setup.py install

I get an error (only copied the error section, not the entire output):

src/_portaudiomodule.c(29) : fatal error C1083: Cannot open include file: 'portaudio.h': No such file or directory
error: command 
'C:\\Users\\lukec\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2

BUT - if I use pip install pyaudio, it works fine. Why the discrepancy?

TobyTobyo
  • 405
  • 2
  • 6
  • 20

1 Answers1

1

pip is downloading and installing from prebuilt wheel files. If you take a look at the PyPI page for pyaudio, the latest version is provided as .whl files for Windows versions of Python. These Wheel files already contain the pre-built binaries and C bindings.

Doing python setup.py install like you're doing requires a full build of the Python code and its bindings to the C library for Port Audio. You'll need to get the development files and headers for Port Audio in order for your build to succeed.

wkl
  • 77,184
  • 16
  • 165
  • 176
  • But the pypy page also has it available in a non `.whl` format, as a `.tar.gz`. I'm using the extract from that [link](https://pypi.python.org/packages/ab/42/b4f04721c5c5bfc196ce156b3c768998ef8c0ae3654ed29ea5020c749a6b/PyAudio-0.2.11.tar.gz#md5=7e4c88139284033f67b4336c74eda3b8) – TobyTobyo Sep 12 '17 at 19:32
  • @TobyTobyo the `.tar.gz` is provided for platforms that don't have `.whl` files already built for them, like pretty much all Linux distros, FreeBSD, Mac OSX, etc. If you just did a `pip install pyaudio`, it's going to default to picking the Wheel file if it can find one. If you tried `pip install pyaudio --no-binary :all:` to install PyAudio, you'd probably see the same problem you're seeing because it will attempt to build it from source. – wkl Sep 12 '17 at 19:35