Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyAudio install error : Failed building wheel

I want to install pyaudio but I am getting the following error. I am using windows 10. I have tried solution given in multiple other answers but they were not working for me. I am following a tutorial from YouTube.

code :

import pyttsx3
import datetime
import speech_recognition as sr
import wikipedia
import webbrowser
import os

r=sr.Recognizer()


engine = pyttsx3.init('sapi5')
voices=engine.getProperty('voices')
engine.setProperty('voice' , voices[1].id)



def speak(audio):
    engine.say(audio)
    engine.runAndWait()

def takecommand():
    
    with sr.Microphone() as source:
        print("Listening.....")
        r.pause_threshold=1
        o=r.listen(source)
    try:
        print("Wait for few moments")
        query=r.recognize_google(o,language="en-in")
        print("user said ", query)
    except Exception as e :
        print(e)
        speak("Say that Again Please ")

if __name__ == "__main__":
    wishme()
    takecommand()

    while True :
        wishme()
        query = takecommand().lower()

        if"wikipedia" in query:
            speak("Searching in wikipedia")
            query=query.replace("wikipedia" ,"")
            results=wikipedia.summary(query,sentences=2)
            speak("According to wikipedia ")
            speak(results)
            print(results)

        elif"open youtube" in query:
            speak("opening Boss")
            webbrowser.open("youtube.com")
        elif "open google" in query:
            speak("opening Boss")
            webbrowser.open("google.com")

        elif "open code"in query:
            speak("opening Boss")
            codepath = "C:\\Users\\Murali\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe"
            os.startfile(codepath)

        elif "open chrome"in query:
            speak("opening Boss")
            chromepath = "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"
            os.startfile(chromepath)

This image when I use pipwin

This image when I use pip

edit1 : I have tried pip install PyAudio as well and it did not work

enter image description here


1 Answers

I was able to resolve the issue by running the following commands: sudo apt-get install portaudio19-dev Then... pip install pyaudio

like image 55
Gonzalo Leonel Gramajo Avatar answered Feb 03 '26 10:02

Gonzalo Leonel Gramajo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!