speech_recognition
speech_recognition copied to clipboard
ModuleNotFoundError: No module named 'speech_recognition' in Fedora 26
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>.
Hi @rajnishcoder,
Can you post the following information?
- The path that
speech_recognition
has been installed to. - The output of
python -c "import sys; print(sys.path)"
. - How you installed
speech_recognition
(e.g., usingpip
vs. usingpip3
).
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.
Try sudo pip3 install --upgrade speechrecognition
facing the same problem
try pip3 install --upgrade speechrecognition
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
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
cmd say this but i have the same error
import speech_recognition as sr
ModuleNotFoundError: No module named 'speech_recognition'
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
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...
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.
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!!
@staRk22 where is this anaconda folder... i dont have...
Try
sudo pip3 install --upgrade speechrecognition
thanks, work for me.
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
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 >
3-f3e2f800-c4df-11e9-993a-f84730e16d12.png)
-> install Package
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.
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!
I have the same problem Here is my solution
- 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)
- 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
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 thanpip
, 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:
- Calling
pip [package_to_install]
is shortcut for the pip script, through default python version: it is the same aspython -m pip install [package_to_install]
. - It can be tricky to not mess up pip when managing various Python versions, so then pip and even pip3 do not install where you'd like it to be.
- In case python version aliases are properly set up, you can install easily to the Python version just by calling the un-shortened command. Say we want to install packages to Python 3.7, despite
python
calling a 2.7 build andpython3
calling a 3.8 build. Instead of callingpip
orpip3
shortcuts, which most likely are associated to those last ones, use the whole:
python3.7 -m pip install --upgrade [package]
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
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.
Traceback (most recent call last):
File "jarvis_main_code.py", line 48, in
File "jarvis_main_code.py", line 49, in
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
what i did is installed python again but if it still doesnt work then do not use it
I'm getting ModuleNotFoundError: No module named 'speech_recognition'
SpeechRecognition is installed but I could'nt find speechrecognition file. Pleassss help me
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
try pip3 install --upgrade speechrecognition
I used repl.it and I have to manually install the package, and that made it work...
I too, am facing the same problem. :(
Speech recognition is already satisfied?