1

I have being tiring to install python speech recognition for a long time but getting the same problem on running

pip install pyaudio

Output:

Collecting pyaudio
  Using cached PyAudio-0.2.11.tar.gz (37 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: pyaudio
  Building wheel for pyaudio (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [9 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-3.10
      copying src\pyaudio.py -> build\lib.win-amd64-3.10
      running build_ext
      building '_portaudio' extension
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pyaudio
  Running setup.py clean for pyaudio
Failed to build pyaudio
Installing collected packages: pyaudio
  Running setup.py install for pyaudio ... error
  error: subprocess-exited-with-error
  
  × Running setup.py install for pyaudio did not run successfully.
  │ exit code: 1
  ╰─> [9 lines of output]
      running install
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-3.10
      copying src\pyaudio.py -> build\lib.win-amd64-3.10
      running build_ext
      building '_portaudio' extension
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> pyaudio

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

As I understand from:

error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/

I had to install 'Microsoft Visual C++ 14.0 or greater' so I did. But same result even after
that! What am I supposes to do.

2 Answers2

0

You can try this

pip install pipwin
then
pipwin install pyaudio
Jamiu S.
  • 5,257
  • 5
  • 12
  • 34
0

This is not a problem with just you, everyone faces this.

Here's a fix I hope will work for you:

pip install pipwin

pipwin install pyaudio

to install pyaudio via pipwin, sometimes the command doesn't work so try

pipwin refresh and run pipwin install pyaudio again

If the above steps do not work, try going to Python Packages and install your system-specific version of pyaudio.

then opening a cmd instance in the directory you installed the package and run pip install package

replace 'package' with the name of the file you downloaded.

Esvin Joshua
  • 71
  • 14