Uberi / speech_recognition

Speech recognition module for Python, supporting several engines and APIs, online and offline.
https://pypi.python.org/pypi/SpeechRecognition/
BSD 3-Clause "New" or "Revised" License
8.3k stars 2.39k forks source link

ModuleNotFoundError: No module named 'speech_recognition' in Fedora 26 #294

Open rajnishcoder opened 6 years ago

rajnishcoder commented 6 years ago

I already installed speech_recognition and trying to import speech_recognition it gave me ModuleNotFoundError: No module named 'speech_recognition'

Hear is my python code

import speech_recognition as sr

r = sr.Recognizer()

with sr.Microphone() as mp:
    print('say')
    audio = r.listen(mp)

try:
    print(r.recognize_google(audio))

except:
    pass

Here is console error

Traceback (most recent call last):

File "", line 1, in runfile('/home/coder/Documents/python/speechtotext.py', wdir='/home/coder/Documents/python')

File "/usr/lib/python3.6/site-packages/spyder/utils/site/sitecustomize.py", line 710, in runfile execfile(filename, namespace)

File "/usr/lib/python3.6/site-packages/spyder/utils/site/sitecustomize.py", line 101, in execfile exec(compile(f.read(), filename, 'exec'), namespace)

File "/home/coder/Documents/python/speechtotext.py", line 8, in import speech_recognition as sr

ModuleNotFoundError: No module named 'speech_recognition'

System information

My system is <Fedora 26>.

My Python version is <Python 2.7.14> in fedora 26 but I upgraded it to 3.6

My Pip version is <pip 9.0.1>.

My SpeechRecognition library version is <3.7.1>.

Uberi commented 6 years ago

Hi @rajnishcoder,

Can you post the following information?

  1. The path that speech_recognition has been installed to.
  2. The output of python -c "import sys; print(sys.path)".
  3. How you installed speech_recognition (e.g., using pip vs. using pip3).

I would also make sure first of all that it's installed with pip3 rather than pip, since IIRC that would default to installing for Python 2.

mad0ba commented 6 years ago

Try sudo pip3 install --upgrade speechrecognition

esitharth commented 6 years ago

facing the same problem

iamakhilk commented 6 years ago

try pip3 install --upgrade speechrecognition

25shady commented 6 years ago

i-got-the-same-problem-as @rajnishcoder -and-i had-tried-to-resolve-it-by-using-pip3-then-also-i-am-getting-same-module-not-found-error

25shady commented 6 years ago

facing-same-problem-even-after upgrading-speech-recognition-using-pip3-and-if-i-run-it-again-in-the-terminal-it-say-file-already-exist-but-in-python-shell-it-say-module-not-found-error

gabbsoares commented 6 years ago

image

cmd say this but i have the same error

import speech_recognition as sr

ModuleNotFoundError: No module named 'speech_recognition'

25shady commented 6 years ago

first-check-the-speech-recognition(sr)-file-from-the-given-path-from-your-terminal-in-that-folder-two-file-of-sr-is-their 1-is-speech_recognition 2-is-SpeechRecognition-3.8.1.dist-info copy-this-both-file-and-paste-it-into-anaconda's-SITE-PACKAGE-file remember-where-your-anaconda's-file-is example-D:\anaconda\Lib\site-packages the-above-mention-directory-is-where-my-anaconda-file-is

sugatoray commented 5 years ago

Solution

Note: I am using a PC. Use pip3 install --upgrade speechrecognition as pointed out by Mardii-D-King.

Observation

'pip install SpeechRecognition' installed the package and I could also import it from cmd followed by checking its version:

import speech_recognition as sr
sr.__version__

However

Running the same from Jupyter Notebook threw the same error as mentioned above. So, trying the following solved it. Run this from inside Jupyter Notebook:

!pip3 install --upgrade speechrecognition
import speech_recognition as sr
sr.__version__

And it was working for me...

staRk22 commented 5 years ago

You must have installed SpeechRecognition from Terminal - cmd and you must be using anaconda or other package libraries like that. What has happened here is that your speech SpeechRecognition has installed in your python local directory. you have to copy it from there and paste it in your anaconda library.

Follow the steps: 1) go to C:\Python\Lib\site-packages 2) Copy files :1: speech_recognition 2: SpeechRecognition-3.8.1.dist-info 3) Paste it in your C:\anaconda\Lib\site-packages

This will fix the problem.

Nahidahmed commented 5 years ago

You must have installed SpeechRecognition from Terminal - cmd and you must be using anaconda or other package libraries like that. What has happened here is that your speech SpeechRecognition has installed in your python local directory. you have to copy it from there and paste it in your anaconda library.

Follow the steps:

  1. go to C:\Python\Lib\site-packages
  2. Copy files :1: speech_recognition 2: SpeechRecognition-3.8.1.dist-info
  3. Paste it in your C:\anaconda\Lib\site-packages

This will fix the problem.

Thanks @staRk22 ...your solution works!!

bishesh23 commented 5 years ago

@staRk22 where is this anaconda folder... i dont have...

ramiresnas commented 5 years ago

Try sudo pip3 install --upgrade speechrecognition thanks, work for me.

alexmursa2013 commented 5 years ago

verify if you don't have a two version python installed ex: 3.7.3 (x64) and 3.7.4 (x32) delete 3.7.3 and it is worked ok next

uzzalmondal131 commented 5 years ago

If you use the python version bellow 3.x.x then try sudo pip3 install --upgrade speechrecognition And If you use pycharm or ID then go to File > Settings > Project: XX > Project Interpreter >

Screenshot from 2019-08-22 13-22-08 3-f3e2f800-c4df-11e9-993a-f84730e16d12.png)

-> install Package

rsmahajan commented 4 years ago

first-check-the-speech-recognition(sr)-file-from-the-given-path-from-your-terminal-in-that-folder-two-file-of-sr-is-their 1-is-speech_recognition 2-is-SpeechRecognition-3.8.1.dist-info copy-this-both-file-and-paste-it-into-anaconda's-SITE-PACKAGE-file remember-where-your-anaconda's-file-is example-D:\anaconda\Lib\site-packages the-above-mention-directory-is-where-my-anaconda-file-is

This worked for me. Thanks.

ghost commented 4 years ago

I have the same problem, but nothing helped me. I tried to upgrade the speechrecognition and copy/paste the files to anaconda path - to no avail... I need your advice people, thank you in advance!

ayushboss1 commented 4 years ago

I have the same problem Here is my solution 1) I downloaded the file into right directory of anaconda. but still, it was not working. (If you have wrong directory path set it up at anaconda/lib/site_packages) 2) I went into the folder then I found out it is not speechrecogniton instead it is speech_recogniton. so I changed the name and it worked for me

pnmartinez commented 4 years ago

Hi @rajnishcoder,

Can you post the following information?

1. The path that `speech_recognition` has been installed to.

2. The output of `python -c "import sys; print(sys.path)"`.

3. How you installed `speech_recognition` (e.g., using `pip` vs. using `pip3`).

I would also make sure first of all that it's installed with pip3 rather than pip, since IIRC that would default to installing for Python 2.

To add on this, a general solution to install packages on a specific Python version, if they are installed:

sscswapnil commented 4 years ago

import speech_recognition as sr

this resolve my problem when I look into python site packages I realise the name os the package is different and I tried Above one and it worked

ArcticLilacFox commented 4 years ago

All of this did not work for me. I cannot find SpeechRecognition in the installable packages for pyCharm. I have installed SpeechRecognition everywhere. In my pytorch environment, conda, python 3.6 as well. Nothing helped. Changing my code from import speech_recognition as sr to import speechrecognition as sr did not make a difference. I am a windows 10 Home user. My interpreter is python 3.6 in conda. I realized I have another .conda folder on my laptop and copied the speech_recognizer file from the other environments there into the /lib/site_packages section. It worked for me, so I hope it helps others that face the same issue.

Rushil-Sharma commented 4 years ago

Traceback (most recent call last): File "jarvis_main_code.py", line 48, in Listen() File "jarvis_main_code.py", line 34, in Listen r = sr.Recognition() AttributeError: module 'speech_recognition' has no attribute 'Recognition'

Rushil-Sharma commented 4 years ago

File "jarvis_main_code.py", line 49, in Listen() File "jarvis_main_code.py", line 35, in Listen with sr.Microphone as source : AttributeError: enter

shaliniverma132 commented 3 years ago

I'm keep getting these errors below😑 C:\python programs\Jarvis>python -u "c:\python programs\Jarvis\jarvis.py" Traceback (most recent call last): File "c:\python programs\Jarvis\jarvis.py", line 2, in import SpeechRecognition ModuleNotFoundError: No module named 'SpeechRecognition' Please help me to resolve my problem.

Rushil-Sharma commented 3 years ago

what i did is installed python again but if it still doesnt work then do not use it

JaysreeeRoyal commented 3 years ago

I'm getting ModuleNotFoundError: No module named 'speech_recognition' Screenshot (4) Screenshot (5)

SpeechRecognition is installed but I could'nt find speechrecognition file. Pleassss help me

Rushil-Sharma commented 3 years ago

you have to go to where it is installed and check if it is running there without an error or you must have changed the code

ghost commented 3 years ago

try pip3 install --upgrade speechrecognition

I used repl.it and I have to manually install the package, and that made it work...

SebS-Dev commented 3 years ago

I too, am facing the same problem. :(

SebS-Dev commented 3 years ago

Speech recognition is already satisfied?

Amira-Abidi commented 3 years ago

If you use the python version bellow 3.x.x then try sudo pip3 install --upgrade speechrecognition And If you use pycharm or ID then go to File > Settings > Project: XX > Project Interpreter >

Screenshot from 2019-08-22 13-22-08 3-f3e2f800-c4df-11e9-993a-f84730e16d12.png)

-> install Package

work for me , thanks

GeorgiVL commented 3 years ago

You must have installed SpeechRecognition from Terminal - cmd and you must be using anaconda or other package libraries like that. What has happened here is that your speech SpeechRecognition has installed in your python local directory. you have to copy it from there and paste it in your anaconda library. Follow the steps:

  1. go to C:\Python\Lib\site-packages
  2. Copy files :1: speech_recognition 2: SpeechRecognition-3.8.1.dist-info
  3. Paste it in your C:\anaconda\Lib\site-packages

This will fix the problem.

Thanks @staRk22 ...your solution works!!

Thanks @staRk22 that helped on me as well :)

sid517 commented 2 years ago

pip install --upgrade speechrecognition Error solve import speech_recognition as sr

Project-fil commented 2 years ago

You must have installed SpeechRecognition from Terminal - cmd and you must be using anaconda or other package libraries like that. What has happened here is that your speech SpeechRecognition has installed in your python local directory. you have to copy it from there and paste it in your anaconda library. Follow the steps:

go to C:\Python\Lib\site-packages Copy files :1: speech_recognition 2: SpeechRecognition-3.8.1.dist-info Paste it in your C:\anaconda\Lib\site-packages This will fix the problem.

Thanks @staRk22 ...your solution works!!

Thanks @staRk22 that helped on me as well :)

Thanks a lot @staRk22 it helped me a lot)))

zahid60 commented 10 months ago

If you use the python version bellow 3.x.x then try sudo pip3 install --upgrade speechrecognition And If you use pycharm or ID then go to File > Settings > Project: XX > Project Interpreter >

Screenshot from 2019-08-22 13-22-08 3-f3e2f800-c4df-11e9-993a-f84730e16d12.png)

-> install Package

Thank you ,its works

miercolesalfonzo commented 8 months ago

pip3 install --upgrade speechrecognition

it happened to me too, i don't know what to do