-2

cannot install pyaudio in command prompt.

  1. pip install pyaudio
  2. python -m pip install PyAudio
  3. python pip install python-pyaudio
Collecting PyAudio
  Using cached https://files.pythonhosted.org/packages/ab/42/b4f04721c5c5bfc196ce156b3c768998ef8c0ae3654ed29ea5020c749a6b/PyAudio-0.2.11.tar.gz
Installing collected packages: PyAudio
  Running setup.py install for PyAudio ... error
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\Nivin\AppData\Local\Programs\Python\Python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Nivin\\AppData\\Local\\Temp\\pip-install-792muqk4\\PyAudio\\setup.py'"'"'; __file__='"'"'C:\\Users\\Nivin\\AppData\\Local\\Temp\\pip-install-792muqk4\\PyAudio\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Nivin\AppData\Local\Temp\pip-record-qs3g__i9\install-record.txt' --single-version-externally-managed --compile
         cwd: C:\Users\Nivin\AppData\Local\Temp\pip-install-792muqk4\PyAudio\
    Complete output (9 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.7
    copying src\pyaudio.py -> build\lib.win-amd64-3.7
    running build_ext
    building '_portaudio' extension
    error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\Nivin\AppData\Local\Programs\Python\Python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Nivin\\AppData\\Local\\Temp\\pip-install-792muqk4\\PyAudio\\setup.py'"'"'; __file__='"'"'C:\\Users\\Nivin\\AppData\\Local\\Temp\\pip-install-792muqk4\\PyAudio\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Nivin\AppData\Local\Temp\pip-record-qs3g__i9\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
jarmod
  • 71,565
  • 16
  • 115
  • 122
  • 4
    If you read the output, you will see "error: Microsoft Visual C++ 14.0 is required" and a link to help you download it. – jarmod Aug 12 '19 at 14:16
  • 1
    “error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": […]” – Seems very self-explanatory to me. – poke Aug 12 '19 at 14:17
  • This might be helpful, I followed this just today. https://stackoverflow.com/questions/54998028/how-do-i-install-pyaudio-on-python-3-7 – aadibajpai Aug 12 '19 at 14:17

1 Answers1

1

Installing pyaudio from source requires MSVC Build tools to be installed on the machine so you need to install it first.

Another alternative is to grab a pre-built wheel package from here and install it via pip:

pip install PyAudio‑0.2.11‑cp37‑cp37m‑win_amd64.whl
Masoud Rahimi
  • 5,785
  • 15
  • 39
  • 67