Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Troubleshooting gpt-start failing #12

Closed
deadsalm0 opened this issue Mar 6, 2024 · 110 comments
Closed

Troubleshooting gpt-start failing #12

deadsalm0 opened this issue Mar 6, 2024 · 110 comments
Assignees
Labels
bug Something isn't working question Further information is requested

Comments

@deadsalm0
Copy link

Hi, i installed everything as explained but the command gpt-start keeps failing with result 'exit-code'

The web interfacce Is working, except for the settings Tab which Is not loading.

Thanks in Advance, you had a Greta idea!

@judahpaul16

This comment was marked as resolved.

@deadsalm0

This comment was marked as resolved.

@deadsalm0

This comment was marked as resolved.

@judahpaul16

This comment was marked as resolved.

@deadsalm0

This comment was marked as resolved.

@deadsalm0 deadsalm0 reopened this Apr 1, 2024
@deadsalm0

This comment was marked as resolved.

@judahpaul16

This comment was marked as resolved.

@judahpaul16 judahpaul16 self-assigned this Apr 3, 2024
@judahpaul16 judahpaul16 added the question Further information is requested label Apr 3, 2024
@jlazerus1

This comment was marked as resolved.

@judahpaul16

This comment was marked as resolved.

@jlazerus1

This comment was marked as resolved.

@judahpaul16

This comment was marked as resolved.

@jlazerus1

This comment was marked as resolved.

@brainhig

This comment was marked as resolved.

@judahpaul16

This comment was marked as resolved.

@judahpaul16

This comment was marked as resolved.

judahpaul16 added a commit that referenced this issue May 6, 2024
judahpaul16 added a commit that referenced this issue May 6, 2024
judahpaul16 added a commit that referenced this issue May 6, 2024
@brainhig

This comment was marked as resolved.

@brainhig

This comment was marked as resolved.

@judahpaul16

This comment was marked as resolved.

@brainhig

This comment was marked as resolved.

@judahpaul16
Copy link
Owner

@brainhig I'll add the package to the contrib folder to be installed directly with dpkg.

sudo dpkg -i contrib/libflac12_armhf.deb

Here's the version in use for future reference:

ubuntu@ubuntu:~$ apt-cache policy libflac12
libflac12:
  Installed: 1.4.2+ds-2ubuntu1
  Candidate: 1.4.2+ds-2ubuntu1
  Version table:
 *** 1.4.2+ds-2ubuntu1 500
        500 http://ports.ubuntu.com/ubuntu-ports lunar/main armhf Packages
        100 /var/lib/dpkg/status

@jlazerus1

This comment was marked as outdated.

@judahpaul16

This comment was marked as outdated.

judahpaul16 added a commit that referenced this issue May 7, 2024
+ Rearranged dependency installation order
+ Use `apt-get` in setup script instead of `apt`
- Check and install python3-venv and python3-dev separately
- May solve @brianhig's problem in issue #12
- Tested and working on my Pi
@judahpaul16
Copy link
Owner

judahpaul16 commented May 9, 2024

@jlazerus1

Something definitely didn't work. Wondering if I should re-run setup again? image

This indicates your .bashrc isn't working either it seems. If this is in your .bashrc then you should be able to reload your terminal or run source ~/.bashrc and use any alias defined in there:

# export your OpenAI API Key in here to initialize it at boot
export OPENAI_API_KEY="your_openai_api_key_here"

# Optional: Add these aliases to your .bashrc file for easier management
alias gpt-start="sudo systemctl start gpt-home"
alias gpt-restart="sudo systemctl restart gpt-home"
alias gpt-stop="sudo systemctl stop gpt-home"
alias gpt-disable="sudo systemctl disable gpt-home"
alias gpt-status="sudo systemctl status gpt-home"
alias gpt-enable="sudo systemctl enable gpt-home"
alias gpt-log="tail -n 100 -f /home/$(whoami)/gpt-home/events.log"

alias web-start="sudo systemctl start gpt-web"
alias web-restart="sudo systemctl restart gpt-web && sudo systemctl restart nginx"
alias web-stop="sudo systemctl stop gpt-web"
alias web-disable="sudo systemctl disable gpt-web"
alias web-status="sudo systemctl status gpt-web"
alias web-enable="sudo systemctl enable gpt-web"
alias web-log="tail -n 100 -f /var/log/nginx/access.log"
alias web-error="tail -n 100 -f /var/log/nginx/error.log"

Also you can run tail -n 100 -f /home/$(whoami)/gpt-home/events.log in place of gpt-log.

For Spotify before I change the setup script. Alter your setup.sh where you see cargo install spotifyd and change it to cargo install spotifyd --jobs 2 and rerun the script. Trying to isolate whether it's a resources issue.

@ashepp
Copy link

ashepp commented May 9, 2024

@ashepp Hmm. Seems like .bashrc just isn't working right. tail -n 100 -f /home/$(whoami)/gpt-home/events.log is the command gpt-log is actually calling. Double-check for typos in your .bashrc. I'm not sure why it wouldn't work.

# export your OpenAI API Key in here to initialize it at boot
export OPENAI_API_KEY="your_openai_api_key_here"

# Optional: Add these aliases to your .bashrc file for easier management
alias gpt-start="sudo systemctl start gpt-home"
alias gpt-restart="sudo systemctl restart gpt-home"
alias gpt-stop="sudo systemctl stop gpt-home"
alias gpt-disable="sudo systemctl disable gpt-home"
alias gpt-status="sudo systemctl status gpt-home"
alias gpt-enable="sudo systemctl enable gpt-home"
alias gpt-log="tail -n 100 -f /home/$(whoami)/gpt-home/events.log"

alias web-start="sudo systemctl start gpt-web"
alias web-restart="sudo systemctl restart gpt-web && sudo systemctl restart nginx"
alias web-stop="sudo systemctl stop gpt-web"
alias web-disable="sudo systemctl disable gpt-web"
alias web-status="sudo systemctl status gpt-web"
alias web-enable="sudo systemctl enable gpt-web"
alias web-log="tail -n 100 -f /var/log/nginx/access.log"
alias web-error="tail -n 100 -f /var/log/nginx/error.log"

yeah. somethings not right nano ~/.bashrc just shows an empty file at this point? Is this an OS level file or is it something you can copy and paste into here and I can reinsert my API key and try again?

@judahpaul16
Copy link
Owner

@ashepp It normally isn't empty but it should be fine. .bashrc is user-specific. Paste that block in there and make sure to save. In nano its Ctrl+O(save) and Ctrl+X(exit). Then:

source ~/.bashrc
gpt-log

@ashepp

This comment was marked as off-topic.

@judahpaul16

This comment was marked as off-topic.

@ashepp

This comment was marked as off-topic.

@judahpaul16
Copy link
Owner

judahpaul16 commented May 9, 2024

@ashepp Moved to a new issue. See #23

@jlazerus1
Copy link

Took a while but is still doing the same thing and spotify is still not working.

image

This is the output of gpt-log:

            ^^^^^^^^^^^^^^^^^^^^^^^^^

File "/home/ubuntu/gpt-home/env/lib/python3.11/site-packages/speech_recognition/audio.py", line 232, in get_flac_data
flac_converter = get_flac_converter()
^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/gpt-home/env/lib/python3.11/site-packages/speech_recognition/audio.py", line 290, in get_flac_converter
raise OSError(
OSError: FLAC conversion utility not available - consider installing the FLAC command line application by running apt-get install flac or your operating system's equivalent

ERROR:functions:Listening timed out: Traceback (most recent call last):
File "/home/ubuntu/gpt-home/app.py", line 16, in main
text = await listen(display, state_task, stop_event)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/gpt-home/functions.py", line 230, in listen
text = await loop.run_in_executor(executor, recognize_audio, loop, state_task, stop_event)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/.pyenv/versions/3.11.9/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/gpt-home/functions.py", line 208, in recognize_audio
text = r.recognize_google(audio)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/gpt-home/env/lib/python3.11/site-packages/speech_recognition/init.py", line 693, in recognize_google
flac_data = audio_data.get_flac_data(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/gpt-home/env/lib/python3.11/site-packages/speech_recognition/audio.py", line 232, in get_flac_data
flac_converter = get_flac_converter()
^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/gpt-home/env/lib/python3.11/site-packages/speech_recognition/audio.py", line 290, in get_flac_converter
raise OSError(
OSError: FLAC conversion utility not available - consider installing the FLAC command line application by running apt-get install flac or your operating system's equivalent

ERROR:functions:Listening timed out: Traceback (most recent call last):
File "/home/ubuntu/gpt-home/app.py", line 16, in main
text = await listen(display, state_task, stop_event)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/gpt-home/functions.py", line 230, in listen
text = await loop.run_in_executor(executor, recognize_audio, loop, state_task, stop_event)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/.pyenv/versions/3.11.9/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/gpt-home/functions.py", line 208, in recognize_audio
text = r.recognize_google(audio)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/gpt-home/env/lib/python3.11/site-packages/speech_recognition/init.py", line 693, in recognize_google
flac_data = audio_data.get_flac_data(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/gpt-home/env/lib/python3.11/site-packages/speech_recognition/audio.py", line 232, in get_flac_data
flac_converter = get_flac_converter()
^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/gpt-home/env/lib/python3.11/site-packages/speech_recognition/audio.py", line 290, in get_flac_converter
raise OSError(
OSError: FLAC conversion utility not available - consider installing the FLAC command line application by running apt-get install flac or your operating system's equivalent

ERROR:functions:Listening timed out: Traceback (most recent call last):
File "/home/ubuntu/gpt-home/app.py", line 16, in main
text = await listen(display, state_task, stop_event)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/gpt-home/functions.py", line 230, in listen
text = await loop.run_in_executor(executor, recognize_audio, loop, state_task, stop_event)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/.pyenv/versions/3.11.9/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/gpt-home/functions.py", line 208, in recognize_audio
text = r.recognize_google(audio)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/gpt-home/env/lib/python3.11/site-packages/speech_recognition/init.py", line 693, in recognize_google
flac_data = audio_data.get_flac_data(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/gpt-home/env/lib/python3.11/site-packages/speech_recognition/audio.py", line 232, in get_flac_data
flac_converter = get_flac_converter()
^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/gpt-home/env/lib/python3.11/site-packages/speech_recognition/audio.py", line 290, in get_flac_converter
raise OSError(
OSError: FLAC conversion utility not available - consider installing the FLAC command line application by running apt-get install flac or your operating system's equivalent

ERROR:functions:Listening timed out: Traceback (most recent call last):
File "/home/ubuntu/gpt-home/app.py", line 16, in main
text = await listen(display, state_task, stop_event)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/gpt-home/functions.py", line 230, in listen
text = await loop.run_in_executor(executor, recognize_audio, loop, state_task, stop_event)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/.pyenv/versions/3.11.9/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/gpt-home/functions.py", line 208, in recognize_audio
text = r.recognize_google(audio)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/gpt-home/env/lib/python3.11/site-packages/speech_recognition/init.py", line 693, in recognize_google
flac_data = audio_data.get_flac_data(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/gpt-home/env/lib/python3.11/site-packages/speech_recognition/audio.py", line 232, in get_flac_data
flac_converter = get_flac_converter()
^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/gpt-home/env/lib/python3.11/site-packages/speech_recognition/audio.py", line 290, in get_flac_converter
raise OSError(
OSError: FLAC conversion utility not available - consider installing the FLAC command line application by running apt-get install flac or your operating system's equivalent

ERROR:functions:Listening timed out: Traceback (most recent call last):
File "/home/ubuntu/gpt-home/app.py", line 16, in main
text = await listen(display, state_task, stop_event)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/gpt-home/functions.py", line 230, in listen
text = await loop.run_in_executor(executor, recognize_audio, loop, state_task, stop_event)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/.pyenv/versions/3.11.9/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/gpt-home/functions.py", line 208, in recognize_audio
text = r.recognize_google(audio)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/gpt-home/env/lib/python3.11/site-packages/speech_recognition/init.py", line 693, in recognize_google
flac_data = audio_data.get_flac_data(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/gpt-home/env/lib/python3.11/site-packages/speech_recognition/audio.py", line 232, in get_flac_data
flac_converter = get_flac_converter()
^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/gpt-home/env/lib/python3.11/site-packages/speech_recognition/audio.py", line 290, in get_flac_converter
raise OSError(
OSError: FLAC conversion utility not available - consider installing the FLAC command line application by running apt-get install flac or your operating system's equivalent

@jlazerus1
Copy link

Update: I installed flac and I'm getting further... Its now listening for the keyword but isn't recognizing the api keys for gpt or openweathermap.

INFO:functions:Could not understand audio, waiting for a new phrase...
INFO:functions:Timed out, waiting for phrase to start...
INFO:functions:Could not understand audio, waiting for a new phrase...
INFO:functions:Could not understand audio, waiting for a new phrase...
SUCCESS:functions:Heard: "computer whats the date"
INFO:openai:error_code=None error_message="You didn't provide an API key. You need to provide your API key in an Authorization header using Bearer auth (i.e. Authorization: Bearer YOUR_KEY), or as the password field (with blank username) if you're accessing the API from your browser and are prompted for a username and password. You can obtain an API key from https://platform.openai.com/account/api-keys." error_param=None error_type=invalid_request_error message='OpenAI API error received' stream_error=False
ERROR:functions:Error on try 1: You didn't provide an API key. You need to provide your API key in an Authorization header using Bearer auth (i.e. Authorization: Bearer YOUR_KEY), or as the password field (with blank username) if you're accessing the API from your browser and are prompted for a username and password. You can obtain an API key from https://platform.openai.com/account/api-keys.
INFO:openai:error_code=None error_message="You didn't provide an API key. You need to provide your API key in an Authorization header using Bearer auth (i.e. Authorization: Bearer YOUR_KEY), or as the password field (with blank username) if you're accessing the API from your browser and are prompted for a username and password. You can obtain an API key from https://platform.openai.com/account/api-keys." error_param=None error_type=invalid_request_error message='OpenAI API error received' stream_error=False
ERROR:functions:Error on try 2: You didn't provide an API key. You need to provide your API key in an Authorization header using Bearer auth (i.e. Authorization: Bearer YOUR_KEY), or as the password field (with blank username) if you're accessing the API from your browser and are prompted for a username and password. You can obtain an API key from https://platform.openai.com/account/api-keys.
INFO:openai:error_code=None error_message="You didn't provide an API key. You need to provide your API key in an Authorization header using Bearer auth (i.e. Authorization: Bearer YOUR_KEY), or as the password field (with blank username) if you're accessing the API from your browser and are prompted for a username and password. You can obtain an API key from https://platform.openai.com/account/api-keys." error_param=None error_type=invalid_request_error message='OpenAI API error received' stream_error=False
ERROR:functions:Error on try 3: You didn't provide an API key. You need to provide your API key in an Authorization header using Bearer auth (i.e. Authorization: Bearer YOUR_KEY), or as the password field (with blank username) if you're accessing the API from your browser and are prompted for a username and password. You can obtain an API key from https://platform.openai.com/account/api-keys.
CRITICAL:functions:An error occurred: Something Went Wrong: expected string or bytes-like object, got 'NoneType'
INFO:functions:Could not understand audio, waiting for a new phrase...
SUCCESS:functions:Successfully connected to openweather.
INFO:functions:Could not understand audio, waiting for a new phrase...
ERROR:functions:Error: Traceback (most recent call last):
SUCCESS:functions:Something went wrong. No Open Weather API key found. Please enter your API key for Open Weather in the web interface or try reconnecting the service.
INFO:functions:Could not understand audio, waiting for a new phrase...
INFO:functions:Could not understand audio, waiting for a new phrase...

@judahpaul16
Copy link
Owner

@jlazerus1 Is your openai api key exported in your .bashrc? For open weather you have to configure it in the web interface on the integrations tab.

@jlazerus1
Copy link

It is in bashrc and I even tried the export manually. I did enter the openweathermap api key in the web console too.

@judahpaul16
Copy link
Owner

@jlazerus1 when you look inside the systemd file for gpt-home do you see the key in there?

sudo cat /etc/systemd/system/gpt-home

Is openweathermap resolved or still saying no key?

@jlazerus1
Copy link

No, neither are working and I do not see a key in system/gpt-home. Shows no file or directory.

image

@judahpaul16
Copy link
Owner

@jlazerus1 Sorry it's:

sudo cat /etc/systemd/system/gpt-home.service

@jlazerus1
Copy link

That did return a response but I do not see the key in there.
image

@judahpaul16
Copy link
Owner

@jlazerus1 Does echo $OPENAI_API_KEY print the key?

@jlazerus1
Copy link

It does not.

@judahpaul16
Copy link
Owner

judahpaul16 commented May 9, 2024

@jlazerus1 Make sure when you export you include the double quotes. Remove any existing api key export in your ~/.bashrc. Also make sure you're including the . in front of bashrc.

export OPENAI_API_KEY="value"
echo 'export OPENAI_API_KEY="value"' >> ~/.bashrc
source ~/.bashrc

@jlazerus1
Copy link

Now when I echo, I do see the api key. But I'm still getting errors.

image

@judahpaul16
Copy link
Owner

@jlazerus1 Rerun the setup script so the service can be recreated with the environment variable.

@judahpaul16
Copy link
Owner

@jlazerus1 If OpenWeather and Spotifyd is still giving trouble, open a new issue. Marking this issue resolved.

@ashepp
Copy link

ashepp commented May 9, 2024

@ashepp It normally isn't empty but it should be fine. .bashrc is user-specific. Paste that block in there and make sure to save. In nano its Ctrl+O(save) and Ctrl+X(exit). Then:

source ~/.bashrc
gpt-log

I'll give this a go soon. Does it matter that the file is completely empty? There was a bunch of stuff in there before when I last appended it, so just not sure why it disappeared into the ether.

@judahpaul16 judahpaul16 unpinned this issue May 9, 2024
@judahpaul16
Copy link
Owner

@ashepp

I'll give this a go soon. Does it matter that the file is completely empty? There was a bunch of stuff in there before when I last appended it, so just not sure why it disappeared into the ether.

Likely forgot to type the . before bashrc. If you ls -la you might notice another file bashrc but the one the system looks for is .bashrc. Shouldn't matter if it's empty but it's not usually empty.

@ashepp
Copy link

ashepp commented May 10, 2024

@ashepp It normally isn't empty but it should be fine. .bashrc is user-specific. Paste that block in there and make sure to save. In nano its Ctrl+O(save) and Ctrl+X(exit). Then:

source ~/.bashrc
gpt-log

ouput3.txt

I opened the .bashrc file and added my API key (it looked like it was non empty this time, maybe that was my user error). My API key is there. I than ran the commands you provided. While it listens to the wake word it seems that it's not finding the API Key or something else based on the attached logging?
ouput3.txt

@ashepp
Copy link

ashepp commented May 10, 2024

@ashepp It normally isn't empty but it should be fine. .bashrc is user-specific. Paste that block in there and make sure to save. In nano its Ctrl+O(save) and Ctrl+X(exit). Then:

source ~/.bashrc
gpt-log

ouput3.txt

I opened the .bashrc file and added my API key (it looked like it was non empty this time, maybe that was my user error). My API key is there. I than ran the commands you provided. While it listens to the wake word it seems that it's not finding the API Key or something else based on the attached logging? ouput3.txt

Here is my .bashrc file with my key value removed and replaced with "MY KEY" in case that's helpful.
mybash.txt

@ashepp
Copy link

ashepp commented May 10, 2024

After using chatgpt to help debug (I think my API key wasn't being set in some .profile file). the system is taking the API key and responding via the OLED. However, I've seen to have lost audio! I'd like to be able to install the latest build to see if that works. Can you explicitly add how to update to the home page maybe?

@judahpaul16
Copy link
Owner

@ashepp check out the latest release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants