Explore Courses Blog Tutorials Interview Questions
0 votes
in Python by (50.2k points)

I am currently working with python 3.8. I was forming a Jarvis using a tutorial video and all was operating fine until I use the speech recognition package. It is just displaying good afternoon sir message after that it is showing an error which is:

Traceback (most recent call last):

  File "C:\Users\Dell\AppData\Local\Programs\Python\Python38\lib\site-packages\speech_recognition\", line 108, in get_pyaudio

    import pyaudio

ModuleNotFoundError: No module named 'pyaudio'

When I was checking the above exception, another error occurred:

Traceback (most recent call last):

  File "c:\Users\Dell\Desktop\", line 48, in <module>

    query = takeCommand().lower()

  File "c:\Users\Dell\Desktop\", line 28, in takeCommand

    with sr.Microphone() as source:

  File "C:\Users\Dell\AppData\Local\Programs\Python\Python38\lib\site-packages\speech_recognition\", line 79, in __init__

    self.pyaudio_module = self.get_pyaudio()

  File "C:\Users\Dell\AppData\Local\Programs\Python\Python38\lib\site-packages\speech_recognition\", line 110, in get_pyaudio

    raise AttributeError("Could not find PyAudio; check installation")

AttributeError: Could not find PyAudio; check installation

#I have also installed pyaudio which is even showing error.

import pyttsx3

import speech_recognition as sr

import datetime

import wikipedia

import webbrowser

engine = pyttsx3.init('sapi5')

voices = engine.getProperty('voices')

engine.setProperty('voice', voices[0].id)

def speak(audio):



def wishMe():

    hour = int(

    if hour>=0 and hour<12:

        speak('Good Morning Sir')

    elif hour>=12 and hour<18:

        speak('Good Afternoon sir')


        speak('Good Evening sir')    

    speak('I am Jarvis')   

def takeCommand():

    r = sr.Recognizer()

    with sr.Microphone() as source:


        r.pause_threshold = 1

        audio = r.listen(source)



        query = r.recognize_google(audio, language='en')

        print(f"User said: {query}\n")

    except Exception as e:

        print('say that again pls sir')

        return "None"

    return query       

if __name__ == "__main__":


   while True:

        query = takeCommand().lower()

   #executing task based on query

        if 'wikipedia' in query:

            speak('Searching wikipedia')

            query = query.replace("wikipedia", "")

            results = wikipedia.summary(query, sentences=2)

            speak("According to Wikipedia")


        elif 'open YouTube' in query:


1 Answer

0 votes
by (108k points)

I think that you have not installed the package in the correct manner, Kindly use the below code that will help you to install the necessary packages in your python environment:

!pip install pipwin

!pipwin install pyaudio

Kick-start your career in Python with the Intellipaat's perfect Python Course now!


Browse Categories