Speech Recognition module not working, despite being downloaded - python

I was following along a tutorial where they used the SpeechRecognition module, but when I made it to the first test it returns C:\Users\USER\PycharmProjects\Fatawi\venv\Scripts\python.exe C:/Users/USER/PycharmProjects/Fatawi/main.py Traceback (most recent call last): File "C:\Users\USER\PycharmProjects\Fatawi\main.py", line 1, in <module> import speech_recognition as sr ModuleNotFoundError: No module named 'speech_recognition'
I've tried reinstalling the library multiple times along with the PyAudio library. I ran the test that PyPi has for it and it works, but I don't know how fix it from here.

Check your python interpreter environment (the python version that's run the python file) maybe it's not the same version as python when you downloaded Speech Recognition.
Check if you activating the environemt.
For better understand see this blog in geeks for geeks might help you.

So aftergoing through some of the settings of the project file and checking the Python Interpreter it didn't have the SpeechRecognition Package. So I'm assuming that something went wrong with the install.
Thank you Faisal Faraj for the help.

Related

Python module, pyttsx3 not recognised in VS code or pycharm

I am trying to make a bot that responds to certain question asked like ‘what is the time’ . I am trying to use pyttsx3 module to make it work but this error is coming:
Traceback (most recent call last):
File "/Users/HarAd MAC/Desktop/Projects/Python_Work/bot.py", line 1, in <module>
import pyttsx
ImportError: No module named pyttsx3
I have download the module and checked it in VS code Terminal. It is also showing Requirement already satisfied. Can someone help me in this problem. Same error was shown when I was trying to run it in pycharm. These type of problems have also occurred when using modules that have to be download manually.
I am using MacBook Air big Sur and python 3.9.
Thanks.
I don't know for sure but I believe when your import the library you have to do import pyttsx3 while what you were doing is import pyttsx. Here's some more info on usage and how to import

ImportError of module libscrc on Raspberry Pi 3

I'm kinda new to Rpi's and I have a problem executing a library called libscrc with python (I use python3), I need this to calculate a crc checksum for my RS485 communication. On pycharm on my PC everything works fine, but when I implement this on my RPI3 I get errors, I already managed to install the pyserial library and this works fine, but I keep getting errors when trying to run libscrc (this is the link to the library: https://pypi.org/project/libscrc/ ). This is the error:
Traceback (most recent call last):
File "Rs_485.py", line 1, in <module>
import libscrc
File "/home/pi/.local/lib/python3.6/site-packages/libscrc/__init__.py", line 14, in <module>
from ._crcx import *
ImportError: libpython3.6m.so.1.0: cannot open shared object file: No such file or directory
Can anyone help me? I already updated and upgraded the RPI.
When I try the following test command
pi#raspberrypi:~/codes $ python -m libscrc.testmodbus
I get:
/usr/bin/python: No module named libscrc
And I'm using python3.6 by the way
Give it a try by using the github link of the libscrc project
!pip install git+https://github.com/hex-in/libscrc.git
It worked this way for me! cheers!
The answer was found! Hope this wil help anyone out with the same problem!
Use this command!:
sudo apt-get install libpython3.6
this did the job for me! :)

ImportError: No module named stdio, any way to start fresh with python?

I'm getting the error
Traceback (most recent call last):
File "ghs.py", line 1, in <module>
import stdio
ImportError: No module named stdio
When I try to run my script. I can run my script on other machines just fine. I have installed python using homebrew. And I've tried everything I can think of to get it to recognize my modules! I've uninstalled and reinstalled using brew. I've tried changing the path (though I don't fully understand this). I get no issues using brew doctor.
I've also tried using a python virtual environment but to no avail.
Any ideas on how to fix this issue or else 'start fresh' from a fresh version of python?
When you import a module, Python looks for it at the directory your code is, and the directory in which the built-in libraries are (C:\Users\pc\AppData\Local\Programs\Python\Python35-32\Lib in my case, I'm using Windows 10 and Python 3.5). If it can't find it, it raises ImportError.
I couldn't find a module named stdio in my computer. I also know some C++ and as far as I know, stdio is the library for inputs and outputs(prints). In python, there is no need to import such a library.
You can use try,except statement to test if your code works without importing the module like this.
try:
import stdio
except:
#rest of your code goes here
You will need to indent your whole code however this can be done easily with a text editor in which you can edit more than one line at a time.

Error importing opencv, unable to import VideoCapturePlayer

I am trying to work with OpenCV in Python 2.7, however when I simply import cv2, I am getting this error:
>>> import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "cv2.py", line 9, in <module>
from VideoCapturePlayer import *
ImportError: No module named VideoCapturePlayer
I figured that VideoCapturePlayer may be in pygame or pycam, but when I import both, no problems arise.
I have searched my folders and the web for VideoCapturePlayer. My folders do not contain it, and the internet provided a .py file, but I do not know where I should put it. Any help is greatly appreciated, thank you.
Edit: I guess I should include that I am on Windows 7 64-bit
The link you provided is for downloading the entire OpenCV project, including all the libraries and bindings for C++, Java, etc. etc. For the Python bindings, it's much easier to visit my favorite module site on the Internet, Christoph Gohlke's Python Extension Packages for Windows repository. Find the OpenCV section, pick AMD64 or Win32, pick py2.7 or py2.6, and wait a bit for the self-extracting archive to download. Run it, hit OK for all the prompts, and you should be all set. Fire up IDLE or run python from the command line, and running import cv2 should give you no response at all - indicating that everything got set up just fine.
Good luck!

Python: Installing and using Exscript module Windows x86

I have been banging my head against the wall trying to get Exscript installed. After multiple failed attempts at doing it manually, I installed ActivePython and had success running "pypm install Exscript" from the cmd prompt.
I am now going through the Exscript documentation (found here https://github.com/knipknap/exscript/wiki/Python-API-Tutorial) and if I run the first example script I get an error:
>>> from Exscript.util.interact import read_login
Traceback (most recent call last):
File "<pyshell#6>", line 1, in <module>
from Exscript.util.interact import read_login
ImportError: No module named interact
So, I understand that this is saying that there is no module interact. How can I check this? Is there a way I can manually add this module? I would love to know WHY this module didnt come with the package, but that may be impossible to answer :)
Any and all help is greatly appreciated. Thank you
EDIT -
import Exscript.util works but if I try import Exscript.util.Interact I get the error. When I look in util.py I see an entry that says "from FooLib import Interact". I first thought it may just be a capitalization error (Exscript.util.interact vs util.Interact) but neither of those work. I am not sure where to go from here... :(
EDIT -
I have posted this question on the developers forums, hopefully he will have an answer for us. https://github.com/knipknap/exscript/issues/15
EDIT -
The developer suggested that I was using an old version and told me to download the latest. I had struggled installing the module manually so I googled how to easily install py modules. I found a writeup on easy_install.exe. I ran "c:\Python26>easy_install C:\Users\support\Desktop\lou\knipknap-exscript-v2.1-70-gf5583f3.tar.gz" from the cmd prompt, the module was installed (no errors) and now when i run the script it works.
Next challenge will be how to get these scripts to run as stand-alone exe's on users computers without Python installed :)
THANK YOU to everyone to commented I truely appreciate your help.
Lou
One common way packages are installed is as directories. So check your site-packages directory for an Exscript directory, and inside that there should be a util directory, and inside that there should be an interact.py file. Look for similar spellings in case the tutorial misspelled something.

Categories