0

Currently trying to install PyAudio on my Surface Pro 7, and am getting this error code when I try to use the prompt pip install PyAudio to install it:

 ERROR: Command errored out with exit status 1:

src/_portaudiomodule.c: note: see previous definition of 'MS_WIN64'
    src/_portaudiomodule.c(29): fatal error C1083: Cannot open include file: 'portaudio.h': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.28.29333\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2

Can someone help explain why this won't work, please? Thanks!

mosc9575
  • 5,618
  • 2
  • 9
  • 32

2 Answers2

0

Download a wheel file from https://www.lfd.uci.edu/~gohlke/pythonlibs/ and install via pip install wheelfile.whl. Check your python version before downloading.

Leemosh
  • 883
  • 6
  • 19
  • This is incorrect. The error statement clearly states that the PortAudio header file does not exist. They must separately install it because they used pip, or they can use Anaconda. – DapperDuck Jan 08 '21 at 19:41
  • my bad, getting used to "can't install pyaudio", its always the same – Leemosh Jan 08 '21 at 19:42
0

This issue means that the PyAudio library has a script with an include statement for the portaudio header file. Include statements in C and similar languages are like Import statements in Python. Because the file doesn't exist, the library can't run.

If PyAudio is installed via pip, PortAudio has to be downloaded separately. Here is the official website with instructions to download.

An alternative would be to use Anaconda to install packages for python. Anaconda will automatically install portaudio, or provide a reason why it can't, in which case, you will have to follow the steps on the website linked earlier.

Also, see this SO Question.

DapperDuck
  • 2,728
  • 1
  • 9
  • 21