i have an error while making an artificial assistant in python - python

i have an error with speech recognition and pyaudio but it's all installed
PS C:\Users\giova> & C:/Users/giova/AppData/Local/Microsoft/WindowsApps/python3.10.exe
"c:/Users/giova/OneDrive/Desktop/python/ai e assistenti/assistente tutorial pit pro/assis.py"
Traceback (most recent call last):
File "C:\Users\giova\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\speech_recognition\__init__.py", line 108, in get_pyaudio
import pyaudio
ModuleNotFoundError: No module named 'pyaudio'
AttributeError: Could not find PyAudio; check installation
PS C:\Users\giova> & C:/Users/giova/AppData/Local/Microsoft/WindowsApps/python3.10.exe "c:/Users/giova/OneDrive/Desktop/python/ai e assistenti/assistente tutorial pit pro/assis.py"
Traceback (most recent call last):
File "C:\Users\giova\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\speech_recognition\__init__.py", line 108, in get_pyaudio
import pyaudio
ModuleNotFoundError: No module named 'pyaudio'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\Users\giova\OneDrive\Desktop\python\ai e assistenti\assistente tutorial pit pro\assis.py", line 9, in <module>
with Microphone() as source:
File "C:\Users\giova\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\speech_recognition\__init__.py", line 79, in __init__
self.pyaudio_module = self.get_pyaudio()
File "C:\Users\giova\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\speech_recognition\__init__.py", line 110, in get_pyaudio
raise AttributeError("Could not find PyAudio; check installation")
AttributeError: Could not find PyAudio; check installation
with this code :
from pyttsx3 import init
from speech_recognition import Recognizer, Microphone
engine = init()
engine.say("che cavolo vuoi")
engine.runAndWait()
r = Recognizer()
with Microphone() as source:
print("pronto ad ascoltare...")
audio = r.listen(source)
testo = r.recognize_google(audio, Lenguage="it-IT")
print(testo)
I am following an tutorial and idk why this error appears to me

Related

Trying to run Tortoise-TTS program, getting errors

I am trying to run this text-to-speech program
I followed instructions verbatim, but when I go to run the first line of code (below)
python tortoise/do_tts.py --text "I'm going to speak this" --voice random --preset fast
I get he following error code:
C:\Users\chase\anaconda3\lib\site-packages\torchaudio\_internal\module_utils.py:99: UserWarning: Failed to import soundfile. 'soundfile' backend is not available.
warnings.warn("Failed to import soundfile. 'soundfile' backend is not available.")
C:\Users\chase\anaconda3\lib\site-packages\paramiko\transport.py:219: CryptographyDeprecationWarning: Blowfish has been deprecated
"class": algorithms.Blowfish,
Traceback (most recent call last):
File "C:\Users\chase\anaconda3\lib\site-packages\soundfile.py", line 152, in <module>
_snd = _ffi.dlopen(_libname)
OSError: cannot load library 'C:\Users\chase\anaconda3\Library\bin\sndfile.dll': error 0x7e
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\chase\anaconda3\lib\site-packages\soundfile.py", line 178, in <module>
_snd = _ffi.dlopen(_os.path.join(_path, '_soundfile_data', _packaged_libname))
OSError: cannot load library 'C:\Users\chase\anaconda3\lib\site-packages\_soundfile_data\libsndfile_64bit.dll': error 0x7e
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\chase\tortoise-tts\tortoise\do_tts.py", line 7, in <module>
from api import TextToSpeech, MODELS_DIR
File "C:\Users\chase\tortoise-tts\tortoise\api.py", line 22, in <module>
from tortoise.utils.audio import wav_to_univnet_mel, denormalize_tacotron_mel
File "C:\Users\chase\anaconda3\lib\site-packages\tortoise-2.4.2-py3.9.egg\tortoise\utils\audio.py", line 4, in <module>
import librosa
File "C:\Users\chase\anaconda3\lib\site-packages\librosa-0.9.2-py3.9.egg\librosa\__init__.py", line 209, in <module>
from . import core
File "C:\Users\chase\anaconda3\lib\site-packages\librosa-0.9.2-py3.9.egg\librosa\core\__init__.py", line 6, in <module>
from .audio import * # pylint: disable=wildcard-import
File "C:\Users\chase\anaconda3\lib\site-packages\librosa-0.9.2-py3.9.egg\librosa\core\audio.py", line 8, in <module>
import soundfile as sf
File "C:\Users\chase\anaconda3\lib\site-packages\soundfile.py", line 189, in <module>
_snd = _ffi.dlopen(_libname)
OSError: cannot load library 'libsndfile.dll': error 0x7e
I expected it to run
Try on linux, it works fine for me.

pyttsx3 wont return any audio on MacOSX Python 3.9

import speech_recognition as sr
import pyttsx3
listener = sr.Recognizer()
engine = pyttsx3.init()
engine.say("Hi Sasha")
engine.say("How can i help you sir ?")
engine.runAndWait()
try:
with sr.Microphone() as source:
print('listening...')
voice = listener.listen(source)
command = listener.recognize_google(voice)
command = command.lower()
if "jarvis" in command:
print(command)
except:
pass
Hey everyone, trying to do a little vocal assistant with pyttsx3 but even tho i changed and tried everysolution its still dont work.
the error is
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyttsx3/__init__.py", line 20, in init
eng = _activeEngines[driverName]
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/weakref.py", line 134, in __getitem__
o = self.data[key]()
KeyError: None
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/sashakharoubi/Downloads/Portofolio Sasha/IA/ia.py", line 5, in <module>
engine = pyttsx3.init()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyttsx3/__init__.py", line 22, in init
eng = Engine(driverName, debug)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyttsx3/engine.py", line 30, in __init__
self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyttsx3/driver.py", line 52, in __init__
self._driver = self._module.buildDriver(weakref.proxy(self))
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyttsx3/drivers/nsss.py", line 9, in buildDriver
return NSSpeechDriver.alloc().initWithProxy(proxy)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyttsx3/drivers/nsss.py", line 19, in initWithProxy
self._tts.setDelegate_(self)
AttributeError: 'NoneType' object has no attribute 'setDelegate_'
is anyone know what to do ? Thanks
I run it without any errors. Maybe the problem is with the python version, I'm using 3.7.3

PyAudio error Could not find PyAudio; check installation

I'm working on a voice recognition project using the Google Speech Recognition API and every time I try to run the program, it gives me the same error each time:
Traceback (most recent call last):
File "pook.py", line 4, in <module>
with sr.Microphone() as source:
File "Random File name", line 79, in __init__
self.pyaudio_module = self.get_pyaudio()
File "Random File name", line 110, in get_pyaudio
raise AttributeError("Could not find PyAudio; check installation")
AttributeError: Could not find PyAudio; check installation
I've tried to see every post with this same exact error, but none of them seem to work.

python error importing pyttsx

I have been trying to make a basic speech recognition system in python, using pyttx, however, when i run my code:
import speech_recognition
import pyttsx
I get this error:
Traceback (most recent call last):
File "C:\Users\brett\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pyttsx__init__.py", line 37, in init
eng = _activeEngines[driverName]
File "C:\Users\brett\AppData\Local\Programs\Python\Python36-32\lib\weakref.py", line 131, in getitem
o = self.datakey
KeyError: 'sapi5'
I have tried all solutions on here so far and none of them work, if i try to run the engine driver in pyttsx, I get an error with the driver.py, saying 'main' is not a pack. if i have left out any other info, just let me know

matplotlib python3.4.1 win7

I am using python3.4.1 in win7
And I wana use matplotlib.
but this error code has occured.
Could you help me?
>>> text4.dispersion_plot(["citizens", "democracy", "freedom", "duties", "America"])
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\nltk\draw\dispersion.py", line 25, in dispersion_plot
import pylab
File "C:\Python34\lib\site-packages\pylab.py", line 1, in <module>
from matplotlib.pylab import *
File "C:\Python34\lib\site-packages\matplotlib\__init__.py", line 105, in <module>
import six
ImportError: No module named 'six'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<pyshell#5>", line 1, in <module>
text4.dispersion_plot(["citizens", "democracy", "freedom", "duties", "America"])
File "C:\Python34\lib\site-packages\nltk\text.py", line 445, in dispersion_plot
dispersion_plot(self, words)
File "C:\Python34\lib\site-packages\nltk\draw\dispersion.py", line 27, in dispersion_plot
raise ValueError('The plot function requires the matplotlib package (aka pylab).'
ValueError: The plot function requires the matplotlib package (aka pylab).See
http://matplotlib.sourceforge.net/
>>>

Categories