ImportError: No module named 'speech_recognition' in python IDLE

Question:

I’m trying to use the speech recognition module with python 3.5.1 to make my jarvis AI voice activated! I have looked through stack overflow and found some questions similar to mine but they did not have the answer that i needed, i need an answer individualized for this. I have downloaded all the necessary packages and still no luck, i get this error:

ImportError: No module named 'speech_recognition'

If I run:

python -m speech_recognition

In terminal it runs only in terminal, i can talk to it and it isn’t nearly spot on but it hears me and and can interpret some words. I have downloaded all the packages in terminal from this sites instructions.

https://pypi.python.org/pypi/SpeechRecognition/

When i run my code in IDLE my code gets the error shown above. I’m on a iMac running macOS Sierra 10.12.2,
if anyone has the answer that would be helpful.
Thank you!

heres my code:

import speech_recognition
import pyttsx

speech_engine = pyttsx.init('sapi5') # see         
speech_engine.setProperty('rate', 150)

def speak(text):
   speech_engine.say(text)
   speech_engine.runAndWait()

recognizer = speech_recognition.Recognizer()

def listen():
    with speech_recognition.Microphone() as source:
        recognizer.adjust_for_ambient_noise(source)
        audio = recognizer.listen(source)

    try:
        return recognizer.recognize_sphinx(audio) 
        # or: return recognizer.recognize_google(audio)
    except speech_recognition.UnknownValueError:
        print("Could not understand audio")
    except speech_recognition.RequestError as e:
        print("Recog Error; {0}".format(e))

    return ""



speak("Say something!")
speak("I heard you say " + listen())
Asked By: Sergei Glimis

||

Answers:

OS X Sierra comes with Python 2.7.10. Since you are using Python 3.5.1, you have presumably installed it yourself and you now have two versions of Python. IDLE is clearly running with the Python version for which you did not install the speech_recognition module.

What to do depends on your set-up. I’d start by running idle3 from the command line, instead of idle. If your module is installed for Python 3, that’s all you need. If this doesn’t work, check everything with an eye to the different versions and straighten them out the way you want them.

Answered By: alexis

user must be root
so use

sudo pip install --upgrade pip

It will work.

Answered By: Omy

Install Speech Recognition using

pip install SpeechRecognition

Answered By: Senthuja

Try this in windows command prompt for python 3.7 32 bit

python -m pip install -U pip

pip install winspeech

pip install SpeechRecognition
Answered By: Arun Singh

enter image description here

Try This it will work! I had faced the same problem.

 pip install SpeechRecognition
Answered By: Md.Rakibuz Sultan

I upgraded my python to 3.7 in mac, but then I was facing similar issue.

pip3 install SpeechRecognition

this worked for me

Answered By: Supreet Singh

In may case the error was – No module named speechRecognition
incase that’s the case with you try editing the import code and use
import speech_recognition as sr
It worked for me. Sometimes pip gives these issues

Answered By: Geetika-2001

What worked for me was, I installed jupyter notebooks again and on anaconda prompt and then I executed
pip install SpeechRecognition

followed by

pip install PyAudio-0.2.11-cp39-cp39-win_amd64.whl

again.

Answered By: Arju Mann

First, make sure you have all the requirements listed in the “Requirements”:

Install Xcode in Unix Development mode.
Install Xcode – Command Line tools (Type ‘Xcode-select —install’ in the terminal )

**

Install Port or Brew (port  [or] Brew  )
sudo brew install portaudio [or] sudo port install portaudio (for loading mic drivers)
sudo pip install pyaudio [or] sudo easy_install install pyaudio (Mic Sources)
sudo pip install SpeechRecognition [or] sudo easy_install install SpeechRecognition
sudo port install FLAC.

**

Answered By: The Coding Bus

I solved this problem.
I just installed SpeechRecognition in project properties.
Settings -> Project:(nameofyourproject)->
Python: Interpreter. Click on plus and find SpeechRecognition, install it.

Answered By: Wlladik

in pychaem tap the hint(alt+enter) and tap install packages while select the package or tap F2 to take to it .

Answered By: Alwalid54321

for python3 try running the command to install the SpeechRecognition module:
pip3 install SpeechRecognition

Answered By: Mayunga6