Module Importing Problem
Closed this issue · 7 comments
Using
git clone https://github.com/omegaui/linux-voice-control
cd linux-voice-control
./install.sh
Instalation is completed, but when running program a problem appears.
Traceback (most recent call last):
File "/home/hodor/lvc-bin/main.py", line 19, in
import chatgpt_port
File "/home/hodor/lvc-bin/chatgpt_port.py", line 5, in
import chatgpt_wrapper
ModuleNotFoundError: No module named 'chatgpt_wrapper'
when I try running it
Problem is probably connected with $PYTHONPATH a setup.py file would solve the problem.
The problem is more complex, I don't know what is wrong but leave this to present problems.
https://chat.openai.com/share/c89a2b32-e45a-4134-9088-e28ba068f816
@matstep0
Thanks for your valuable investigation,
openai keeps changing API of their chatgpt module,
I will fix this soon.
i have the same problem, any fix?
@Shidari4ld
I'll be fixing this tomorrow.
@Shidari4ld I'll be fixing this tomorrow.
thanks, and good luck
The problem is more complex, I don't know what is wrong but leave this to present problems. https://chat.openai.com/share/c89a2b32-e45a-4134-9088-e28ba068f816
i tried following those steps but now am getting a lot of errors
"python3 main.py
/home/shi6ix/.local/lib/python3.10/site-packages/thefuzz/fuzz.py:11: UserWarning: Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove this warning
warnings.warn('Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove this warning')
torchvision is not available - cannot save figures
Exception in callback MPV.init..mpv_event_extractor() at /home/shi6ix/.local/lib/python3.10/site-packages/mpv.py:276
handle: <Handle MPV.init..mpv_event_extractor() at /home/shi6ix/.local/lib/python3.10/site-packages/mpv.py:276>
Traceback (most recent call last):
File "/home/shi6ix/.local/lib/python3.10/site-packages/mpv.py", line 254, in _event_generator
raise StopIteration()
StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/home/shi6ix/.local/lib/python3.10/site-packages/mpv.py", line 278, in mpv_event_extractor
for event in _event_generator(self.handle):
RuntimeError: generator raised StopIteration
Exception in callback MPV.init..mpv_event_extractor() at /home/shi6ix/.local/lib/python3.10/site-packages/mpv.py:276
handle: <Handle MPV.init..mpv_event_extractor() at /home/shi6ix/.local/lib/python3.10/site-packages/mpv.py:276>
Traceback (most recent call last):
File "/home/shi6ix/.local/lib/python3.10/site-packages/mpv.py", line 254, in _event_generator
raise StopIteration()
StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/home/shi6ix/.local/lib/python3.10/site-packages/mpv.py", line 278, in mpv_event_extractor
for event in _event_generator(self.handle):
RuntimeError: generator raised StopIteration
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
ALSA lib pcm_oss.c:397:(_snd_pcm_oss_open) Cannot open device /dev/dsp
ALSA lib pcm_oss.c:397:(_snd_pcm_oss_open) Cannot open device /dev/dsp
ALSA lib confmisc.c:160:(snd_config_get_card) Invalid field card
ALSA lib pcm_usb_stream.c:482:(_snd_pcm_usb_stream_open) Invalid card 'card'
ALSA lib confmisc.c:160:(snd_config_get_card) Invalid field card
ALSA lib pcm_usb_stream.c:482:(_snd_pcm_usb_stream_open) Invalid card 'card'
Exception in callback MPV.init..mpv_event_extractor() at /home/shi6ix/.local/lib/python3.10/site-packages/mpv.py:276
handle: <Handle MPV.init..mpv_event_extractor() at /home/shi6ix/.local/lib/python3.10/site-packages/mpv.py:276>
Traceback (most recent call last):
File "/home/shi6ix/.local/lib/python3.10/site-packages/mpv.py", line 254, in _event_generator
raise StopIteration()
StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/home/shi6ix/.local/lib/python3.10/site-packages/mpv.py", line 278, in mpv_event_extractor
for event in _event_generator(self.handle):
RuntimeError: generator raised StopIteration
Exception in callback MPV.init..mpv_event_extractor() at /home/shi6ix/.local/lib/python3.10/site-packages/mpv.py:276
handle: <Handle MPV.init..mpv_event_extractor() at /home/shi6ix/.local/lib/python3.10/site-packages/mpv.py:276>
Traceback (most recent call last):
File "/home/shi6ix/.local/lib/python3.10/site-packages/mpv.py", line 254, in _event_generator
raise StopIteration()
StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/home/shi6ix/.local/lib/python3.10/site-packages/mpv.py", line 278, in mpv_event_extractor
for event in _event_generator(self.handle):
RuntimeError: generator raised StopIteration
Exception in callback MPV.init..mpv_event_extractor() at /home/shi6ix/.local/lib/python3.10/site-packages/mpv.py:276
handle: <Handle MPV.init..mpv_event_extractor() at /home/shi6ix/.local/lib/python3.10/site-packages/mpv.py:276>
Traceback (most recent call last):
File "/home/shi6ix/.local/lib/python3.10/site-packages/mpv.py", line 254, in _event_generator
raise StopIteration()
StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/home/shi6ix/.local/lib/python3.10/site-packages/mpv.py", line 278, in mpv_event_extractor
for event in _event_generator(self.handle):
RuntimeError: generator raised StopIteration
Exception in callback MPV.init..mpv_event_extractor() at /home/shi6ix/.local/lib/python3.10/site-packages/mpv.py:276
handle: <Handle MPV.init..mpv_event_extractor() at /home/shi6ix/.local/lib/python3.10/site-packages/mpv.py:276>
Traceback (most recent call last):
File "/home/shi6ix/.local/lib/python3.10/site-packages/mpv.py", line 254, in _event_generator
raise StopIteration()
StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/home/shi6ix/.local/lib/python3.10/site-packages/mpv.py", line 278, in mpv_event_extractor
for event in _event_generator(self.handle):
RuntimeError: generator raised StopIteration
Exception in callback MPV.init..mpv_event_extractor() at /home/shi6ix/.local/lib/python3.10/site-packages/mpv.py:276
handle: <Handle MPV.init..mpv_event_extractor() at /home/shi6ix/.local/lib/python3.10/site-packages/mpv.py:276>
Traceback (most recent call last):
File "/home/shi6ix/.local/lib/python3.10/site-packages/mpv.py", line 254, in _event_generator
raise StopIteration()
StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/home/shi6ix/.local/lib/python3.10/site-packages/mpv.py", line 278, in mpv_event_extractor
for event in _event_generator(self.handle):
RuntimeError: generator raised StopIteration
Exception in callback MPV.init..mpv_event_extractor() at /home/shi6ix/.local/lib/python3.10/site-packages/mpv.py:276
handle: <Handle MPV.init..mpv_event_extractor() at /home/shi6ix/.local/lib/python3.10/site-packages/mpv.py:276>
Traceback (most recent call last):
File "/home/shi6ix/.local/lib/python3.10/site-packages/mpv.py", line 254, in _event_generator
raise StopIteration()
StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/home/shi6ix/.local/lib/python3.10/site-packages/mpv.py", line 278, in mpv_event_extractor
for event in _event_generator(self.handle):
RuntimeError: generator raised StopIteration
Exception in callback MPV.init..mpv_event_extractor() at /home/shi6ix/.local/lib/python3.10/site-packages/mpv.py:276
handle: <Handle MPV.init..mpv_event_extractor() at /home/shi6ix/.local/lib/python3.10/site-packages/mpv.py:276>
Traceback (most recent call last):
File "/home/shi6ix/.local/lib/python3.10/site-packages/mpv.py", line 254, in _event_generator
raise StopIteration()
StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/home/shi6ix/.local/lib/python3.10/site-packages/mpv.py", line 278, in mpv_event_extractor
for event in _event_generator(self.handle):
RuntimeError: generator raised StopIteration
Exception in callback MPV.init..mpv_event_extractor() at /home/shi6ix/.local/lib/python3.10/site-packages/mpv.py:276
handle: <Handle MPV.init..mpv_event_extractor() at /home/shi6ix/.local/lib/python3.10/site-packages/mpv.py:276>
Traceback (most recent call last):
File "/home/shi6ix/.local/lib/python3.10/site-packages/mpv.py", line 254, in _event_generator
raise StopIteration()
StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/home/shi6ix/.local/lib/python3.10/site-packages/mpv.py", line 278, in mpv_event_extractor
for event in _event_generator(self.handle):
RuntimeError: generator raised StopIteration
🐧 loading commands file ...
🚀 voice control ready ... responding every 3 seconds
listening ...
no voice
" i hear the word "greetings" but it doesn't pick up anything i say
for me it is workin, try to create your own file chatgpt_port.py here is mine, that was only thing I changed
# manages user and chatgpt interactions
# author: @omegaui
# github: https://github.com/omegaui/linux-voice-control
# license: GNU GPL v3
import os
import openai
import command_manager
import voice_feedback
bot = None # the ChatGPT bot object
openai.api_key = os.environ.get('OPENAI_API_KEY') #use export OPENAI_API_KEY='key' in terminal or hardcode it here
def chat(text):
"""
handles user-chatgpt interactions
"""
if command_manager.hasText(text, command_manager.deactivateChatMode):
voice_feedback.speak('deactivating chatgpt mode', wait=True)
command_manager.chatMode = False
return
global bot
if not bot:
try:
bot = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": text}
]
)
except Exception as e:
print(e)
print(f"You to ChatGPT: {text}")
response = bot['choices'][0]['message']['content']
voice_feedback.speak(response, wait=True)