judahpaul16 / gpt-home

ChatGPT at home! Basically a better Google Nest Hub or Amazon Alexa home assistant. Built on the Raspberry Pi using the OpenAI API.
https://hub.docker.com/r/judahpaul/gpt-home
GNU General Public License v3.0
271 stars 20 forks source link

Troubleshooting `gpt-start` failing #12

Closed deadsalm0 closed 1 week ago

deadsalm0 commented 2 months ago

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 commented 2 months ago

Hey glad you're interested. I would check the output of journalctl -xeu gpt-home for any clue for what's preventing the systemd service from starting.

deadsalm0 commented 2 months ago

Hi, thanks for replying. I ran the command for both the gpt-home service and gpt-web service with the same results. I'm attaching the web results but it's the same for the home service. 17098229868187812174990113554162

deadsalm0 commented 2 months ago

Just for clarity, i'm running this on a Raspberry 4, without screen, with Just a mic and a speaker.

judahpaul16 commented 2 months ago

Gotcha. Try without the -x so journalctl -eu gpt-home. Could be a permissions issue. Also I noticed your username differs from the default so you may need to make modifications to the setup script I provided, swapping ubuntu for your username (for example the WorkingDirectory=/home/ubuntu/gpt-home line that sets up the service). Also I haven't tested on anything other than ubuntu server but I don't see why another os like Raspian wouldn't work.

deadsalm0 commented 1 month ago

Hi there, Sorry for the late reply, i solved the permission issues, i'm such a noob. Now It reads the files but stops as soon as It tries to initialize the display, which is not installed. I guess i should deactivate some parts of the app.py file and the functions.py file but i can't find which parts to deactivate.

deadsalm0 commented 1 month ago

17119636095404438211926192105798

judahpaul16 commented 1 month ago

No worries. You can Ctrl+F to find and comment out the lines that include initLCD or updateLCD in the app.py and functions.py files. You shouldn't have to remove the full functions definitions; just place a # in front of the lines that call the functions.

Edit: I2C display is optional in latest release

jlazerus1 commented 1 week ago

I too would love to get this working but I'm running into similar issues. I commented out the initLCD and updateLCD but I've tried re-running the setup.sh script and get this:

image

Then it exits and I get this:

image

When I run jounalctl, I get this and then checked and the /activate doesn't exist.

image

Any ideas?

judahpaul16 commented 1 week ago

@jlazerus1 What operating system are you using? Also if your username is piopenai then you may need to find and replace the instances of ubuntu in the setup script as well as in the backend.py file in the connect_service() function:

if name == "spotify":
    spotify_username = fields.get("USERNAME")
    spotify_password = fields.get("PASSWORD")
    os.environ["SPOTIFY_USERNAME"] = spotify_username

    if spotify_username and spotify_password:
        # Update the spotifyd configuration dynamically
        config_path = PARENT_DIRECTORY.parent / ".config/spotifyd/spotifyd.conf"
        with open(config_path, "w") as file:
            file.write("[global]\n")
            file.write(f"username = \"{spotify_username}\"\n")
            file.write(f"password = \"{spotify_password}\"\n")
            file.write("backend = \"alsa\"\n")
            file.write("device_name = \"GPT Home\"\n")
            file.write("bitrate = 320\n")
            file.write("cache_path = \"/home/ubuntu/.spotifyd/cache\"\n")
            file.write("discovery = false\n")

        # Restart spotifyd to apply changes
        subprocess.run(["sudo", "systemctl", "restart", "spotifyd"], check=True)

Edit: I see your username is ubuntu. Could you send a log of the setup script stdout? It might show some error creating the virtual environment. Also make sure the run the script from the home directory.

Edit: The latest release is username agnostic.

jlazerus1 commented 1 week ago

Username is ubuntu. Using Ubuntu server 24.

judahpaul16 commented 1 week ago

@jlazerus1 Send a log of the setup script's stdout. You can send all script's output to a file by running the script like this:

./setup.sh > output.txt 2>&1
jlazerus1 commented 1 week ago

output.txt

brainhig commented 1 week ago

I'm getting the same results: Failures are exactly the same. Using the username "ubuntu" sudo capable. I have tried on both Ubuntu 24.04 and 22.04 with the same outcome. :(

judahpaul16 commented 1 week ago

@jlazerus1 Looks like libflac12:armhf fails to install. You may need to add the universe repository:

sudo add-apt-repository universe
sudo apt update

The other errors seem to be caused by permissions. Try this and rerun the setup script:

sudo chown -R $(whoami):$(whoami) /home/ubuntu/
sudo chmod -R 755 /home/ubuntu/
judahpaul16 commented 1 week ago

It seems I also forgot to add Node the check_install section of the setup script. Ensure Node 18 is installed:

curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - &&\
sudo apt-get install -y nodejs

NodeSource Installation Guide

brainhig commented 1 week ago

Using your new script, libflac12 install is still failing. Also, below errors (maybe related to the flac library?):

Building wheels for collected packages: PyAudio, RPi.GPIO, spidev Building wheel for PyAudio (pyproject.toml) ... error error: subprocess-exited-with-error

× Building wheel for PyAudio (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [19 lines of output] running bdist_wheel running build running build_py creating build creating build/lib.linux-aarch64-cpython-310 creating build/lib.linux-aarch64-cpython-310/pyaudio copying src/pyaudio/init.py -> build/lib.linux-aarch64-cpython-310/pyaudio running build_ext building 'pyaudio._portaudio' extension creating build/temp.linux-aarch64-cpython-310 creating build/temp.linux-aarch64-cpython-310/src creating build/temp.linux-aarch64-cpython-310/src/pyaudio aarch64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/usr/local/include -I/usr/include -I/home/ubuntu/gpt-home/env/include -I/usr/include/python3.10 -c src/pyaudio/device_api.c -o build/temp.linux-aarch64-cpython-310/src/pyaudio/device_api.o In file included from src/pyaudio/device_api.c:1: src/pyaudio/device_api.h:7:10: fatal error: Python.h: No such file or directory 7 | #include "Python.h" | ^~~~~~ compilation terminated. error: command '/usr/bin/aarch64-linux-gnu-gcc' failed with exit code 1 [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for PyAudio

brainhig commented 1 week ago

Here is the libflac12 error:

Installing libflac12:armhf... Reading package lists... Done Building dependency tree... Done Reading state information... Done E: Unable to locate package libflac12:armhf

judahpaul16 commented 1 week ago

@brainhig Python.h is a part of the python development headers. You may have already had python3 installed and since the script only checks if python3 is installed, it possibly didn't install python-dev. Install it with:

sudo apt-get install -y python3-dev

As far as libflac12 goes, maybe try adding the armhf repository manually? Should be included by default but can't hurt to try it:

sudo dpkg --add-architecture armhf
sudo apt-get update

Search to see if there are any available versions of libflac12:

apt-cache search libflac12
brainhig commented 1 week ago

Thanks for the tips. The apt search still shows no results for libflac12. I'll try running the setup again after adding python-dev. This is a new installation of Ubuntu from the Pi imager, so it shouldn't have anything beyond a stock install before running your script.

judahpaul16 commented 1 week ago

@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 commented 1 week ago

Giving this a try this morning. Right now, I'm at this step for about 1.5 hrs.

image
judahpaul16 commented 1 week ago

@jlazerus1 Just have to give it a minute. react-build takes a while.

Edit: Wait 1.5hrs is actually abnormal. Ctrl+C and retry.

brainhig commented 1 week ago

Thank you, @judahpaul16

I was able to build everything without any errors! I had to run an "apt --fix-broken" though as libflac12 had a number of dependencies to correct and install.

Now, I am getting these messages in the log (assuming that the wake word is "computer" - I don't get a response):

INFO:functions:Timed out, waiting for phrase to start... ERROR:functions:Listening timed out: Traceback (most recent call last): ERROR:functions:Listening timed out: Traceback (most recent call last): ERROR:functions:Listening timed out: Traceback (most recent call last): ERROR:functions:Listening timed out: Traceback (most recent call last): ERROR:functions:Listening timed out: Traceback (most recent call last): ERROR:functions:Listening timed out: Traceback (most recent call last): ERROR:functions:Listening timed out: Traceback (most recent call last):

judahpaul16 commented 1 week ago

@brainhig Run gpt-log for the full traceback. The web interface seems to be truncating the error.

Edit: Consider running this before running the setup script:

sudo apt-get purge --auto-remove libflac12 flac libogg0 -y
brainhig commented 1 week ago

Here's the relevant error message below.

I have installed the flac package with "apt install flac" and have new errors, but wake word seems functional. Will post in new message.

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 "/usr/lib/python3.10/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.10/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.10/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.10/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

brainhig commented 1 week ago

New error messages below.

Do we need to have a subscription to use the API?

SUCCESS:functions:Heard: "how are you" INFO:openai:error_code=model_not_found error_message='The model gpt-4 does not exist or you do not have access to it.' error_param=None error_type=invalid_request_error message='OpenAI API error received' stream_error=False ERROR:functions:Error on try 1: The model gpt-4 does not exist or you do not have access to it. INFO:openai:error_code=model_not_found error_message='The model gpt-4 does not exist or you do not have access to it.' error_param=None error_type=invalid_request_error message='OpenAI API error received' stream_error=False ERROR:functions:Error on try 2: The model gpt-4 does not exist or you do not have access to it. INFO:openai:error_code=model_not_found error_message='The model gpt-4 does not exist or you do not have access to it.' error_param=None error_type=invalid_request_error message='OpenAI API error received' stream_error=False ERROR:functions:Error on try 3: The model gpt-4 does not exist or you do not have access to it. CRITICAL:functions:An error occurred: Something Went Wrong: expected string or bytes-like object INFO:functions:Could not understand audio, waiting for a new phrase...

ALSO:

INFO:openai:error_code=insufficient_quota error_message='You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors.' error_param=None error_type=insufficient_quota message='OpenAI API error received' stream_error=False ERROR:functions:Error on try 1: You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors. INFO:openai:error_code=insufficient_quota error_message='You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors.' error_param=None error_type=insufficient_quota message='OpenAI API error received' stream_error=False

judahpaul16 commented 1 week ago

@brainhig gpt-4 you need a subscription for but you shouldn't need a subscription for gpt-3*. https://openai.com/api/pricing

brainhig commented 1 week ago

That's what I thought. However, my model is set to 3.5 turbo, I don't even see an option for gpt-4 in the web interface.

Edit: Oh, now I see it in the menu, but I do have it set for 3.5 image

Edit again: I switched to 3.5-turbo-16k and it seems to work. OK

jlazerus1 commented 1 week ago

I'm still running into some issues.

image image
brainhig commented 1 week ago

I've got it working for the basic functionality, Thank you SO much for your help and quick response!

Now I'm having issues with Open Weather API. Sorry, I'm testing one thing at a time. Please let me know if you want me to start new issues for anything new.

SUCCESS:functions:Heard: "whats the weather in santa fe new mexico" ERROR:functions:Error: Traceback (most recent call last): File "/home/ubuntu/gpt-home/functions.py", line 323, in open_weather_action response = await session.get(f"https://api.openweathermap.org/data/3.0/onecall?lat={coords.get('lat')}&lon={coords.get('lon')}&appid={api_key}&units=imperial") AttributeError: 'NoneType' object has no attribute 'get'

SUCCESS:functions:Something went wrong. 'NoneType' object has no attribute 'get'

ashepp commented 1 week ago

I'm also having trouble getting the webservice to run (followed your install instructions from earlier today).

sudo systemctl status gpt-home.service × gpt-home.service Loaded: loaded (/etc/systemd/system/gpt-home.service; enabled; preset: ena> Active: failed (Result: exit-code) since Tue 2024-05-07 11:11:49 PDT; 23mi> Duration: 153ms Main PID: 8684 (code=exited, status=1/FAILURE) CPU: 147ms

May 07 11:11:49 raspberrypi systemd[1]: gpt-home.service: Scheduled restart job> May 07 11:11:49 raspberrypi systemd[1]: gpt-home.service: Start request repeate> May 07 11:11:49 raspberrypi systemd[1]: gpt-home.service: Failed with result 'e> May 07 11:11:49 raspberrypi systemd[1]: Failed to start gpt-home.service.

ashepp@raspberrypi:~/gpt-home$ ashepp@raspberrypi:~/gpt-home$ sudo journalctl -u gpt-home.service May 07 11:11:44 raspberrypi systemd[1]: Started gpt-home.service. May 07 11:11:44 raspberrypi bash[8665]: Traceback (most recent call last): May 07 11:11:44 raspberrypi bash[8665]: File "/home/ashepp/gpt-home/app.py", line 1, in May 07 11:11:44 raspberrypi bash[8665]: from functions import May 07 11:11:44 raspberrypi bash[8665]: File "/home/ashepp/gpt-home/functions.py", line 3, in May 07 11:11:44 raspberrypi bash[8665]: from dotenv import load_dotenv May 07 11:11:44 raspberrypi bash[8665]: ModuleNotFoundError: No module named 'dotenv' May 07 11:11:44 raspberrypi systemd[1]: gpt-home.service: Main process exited, code=exited, status=1/FAILURE May 07 11:11:44 raspberrypi systemd[1]: gpt-home.service: Failed with result 'exit-code'. May 07 11:11:45 raspberrypi systemd[1]: gpt-home.service: Scheduled restart job, restart counter is at 1. May 07 11:11:45 raspberrypi systemd[1]: Started gpt-home.service. May 07 11:11:45 raspberrypi bash[8668]: Traceback (most recent call last): May 07 11:11:45 raspberrypi bash[8668]: File "/home/ashepp/gpt-home/app.py", line 1, in May 07 11:11:45 raspberrypi bash[8668]: from functions import May 07 11:11:45 raspberrypi bash[8668]: File "/home/ashepp/gpt-home/functions.py", line 3, in May 07 11:11:45 raspberrypi bash[8668]: from dotenv import load_dotenv May 07 11:11:45 raspberrypi bash[8668]: ModuleNotFoundError: No module named 'dotenv' May 07 11:11:45 raspberrypi systemd[1]: gpt-home.service: Main process exited, code=exited, status=1/FAILURE May 07 11:11:45 raspberrypi systemd[1]: gpt-home.service: Failed with result 'exit-code'. May 07 11:11:45 raspberrypi systemd[1]: gpt-home.service: Scheduled restart job, restart counter is at 2. May 07 11:11:45 raspberrypi systemd[1]: Started gpt-home.service. May 07 11:11:45 raspberrypi bash[8670]: Traceback (most recent call last): May 07 11:11:45 raspberrypi bash[8670]: File "/home/ashepp/gpt-home/app.py", line 1, in May 07 11:11:45 raspberrypi bash[8670]: from functions import May 07 11:11:45 raspberrypi bash[8670]: File "/home/ashepp/gpt-home/functions.py", line 3, in May 07 11:11:45 raspberrypi bash[8670]: from dotenv import load_dotenv May 07 11:11:45 raspberrypi bash[8670]: ModuleNotFoundError: No module named 'dotenv' May 07 11:11:45 raspberrypi systemd[1]: gpt-home.service: Main process exited, code=exited, status=1/FAILURE May 07 11:11:45 raspberrypi systemd[1]: gpt-home.service: Failed with result 'exit-code'. May 07 11:11:46 raspberrypi systemd[1]: gpt-home.service: Scheduled restart job, restart counter is at 3. May 07 11:11:46 raspberrypi systemd[1]: Started gpt-home.service. May 07 11:11:46 raspberrypi bash[8672]: Traceback (most recent call last): May 07 11:11:46 raspberrypi bash[8672]: File "/home/ashepp/gpt-home/app.py", line 1, in May 07 11:11:46 raspberrypi bash[8672]: from functions import May 07 11:11:46 raspberrypi bash[8672]: File "/home/ashepp/gpt-home/functions.py", line 3, in May 07 11:11:46 raspberrypi bash[8672]: from dotenv import load_dotenv May 07 11:11:46 raspberrypi bash[8672]: ModuleNotFoundError: No module named 'dotenv' May 07 11:11:46 raspberrypi systemd[1]: gpt-home.service: Main process exited, code=exited, status=1/FAILURE May 07 11:11:46 raspberrypi systemd[1]: gpt-home.service: Failed with result 'exit-code'. May 07 11:11:46 raspberrypi systemd[1]: gpt-home.service: Scheduled restart job, restart counter is at 4. May 07 11:11:46 raspberrypi systemd[1]: Started gpt-home.service. May 07 11:11:46 raspberrypi bash[8674]: Traceback (most recent call last): May 07 11:11:46 raspberrypi bash[8674]: File "/home/ashepp/gpt-home/app.py", line 1, in May 07 11:11:46 raspberrypi bash[8674]: from functions import May 07 11:11:46 raspberrypi bash[8674]: File "/home/ashepp/gpt-home/functions.py", line 3, in May 07 11:11:46 raspberrypi bash[8674]: from dotenv import load_dotenv May 07 11:11:46 raspberrypi bash[8674]: ModuleNotFoundError: No module named 'dotenv' May 07 11:11:46 raspberrypi systemd[1]: gpt-home.service: Main process exited, code=exited, status=1/FAILURE May 07 11:11:46 raspberrypi systemd[1]: gpt-home.service: Failed with result 'exit-code'. May 07 11:11:47 raspberrypi systemd[1]: gpt-home.service: Scheduled restart job, restart counter is at 5. May 07 11:11:47 raspberrypi systemd[1]: Started gpt-home.service. May 07 11:11:47 raspberrypi bash[8676]: Traceback (most recent call last): May 07 11:11:47 raspberrypi bash[8676]: File "/home/ashepp/gpt-home/app.py", line 1, in May 07 11:11:47 raspberrypi bash[8676]: from functions import May 07 11:11:47 raspberrypi bash[8676]: File "/home/ashepp/gpt-home/functions.py", line 3, in May 07 11:11:47 raspberrypi bash[8676]: from dotenv import load_dotenv May 07 11:11:47 raspberrypi bash[8676]: ModuleNotFoundError: No module named 'dotenv' May 07 11:11:47 raspberrypi systemd[1]: gpt-home.service: Main process exited, code=exited, status=1/FAILURE May 07 11:11:47 raspberrypi systemd[1]: gpt-home.service: Failed with result 'exit-code'. May 07 11:11:47 raspberrypi systemd[1]: gpt-home.service: Scheduled restart job, restart counter is at 6. May 07 11:11:47 raspberrypi systemd[1]: Started gpt-home.service. May 07 11:11:47 raspberrypi bash[8678]: Traceback (most recent call last): May 07 11:11:47 raspberrypi bash[8678]: File "/home/ashepp/gpt-home/app.py", line 1, in May 07 11:11:47 raspberrypi bash[8678]: from functions import May 07 11:11:47 raspberrypi bash[8678]: File "/home/ashepp/gpt-home/functions.py", line 3, in May 07 11:11:47 raspberrypi bash[8678]: from dotenv import load_dotenv May 07 11:11:47 raspberrypi bash[8678]: ModuleNotFoundError: No module named 'dotenv' May 07 11:11:47 raspberrypi systemd[1]: gpt-home.service: Main process exited, code=exited, status=1/FAILURE May 07 11:11:47 raspberrypi systemd[1]: gpt-home.service: Failed with result 'exit-code'. May 07 11:11:48 raspberrypi systemd[1]: gpt-home.service: Scheduled restart job, restart counter is at 7. May 07 11:11:48 raspberrypi systemd[1]: Started gpt-home.service. May 07 11:11:48 raspberrypi bash[8680]: Traceback (most recent call last): May 07 11:11:48 raspberrypi bash[8680]: File "/home/ashepp/gpt-home/app.py", line 1, in May 07 11:11:48 raspberrypi bash[8680]: from functions import May 07 11:11:48 raspberrypi bash[8680]: File "/home/ashepp/gpt-home/functions.py", line 3, in May 07 11:11:48 raspberrypi bash[8680]: from dotenv import load_dotenv May 07 11:11:48 raspberrypi bash[8680]: ModuleNotFoundError: No module named 'dotenv' May 07 11:11:48 raspberrypi systemd[1]: gpt-home.service: Main process exited, code=exited, status=1/FAILURE May 07 11:11:48 raspberrypi systemd[1]: gpt-home.service: Failed with result 'exit-code'. May 07 11:11:48 raspberrypi systemd[1]: gpt-home.service: Scheduled restart job, restart counter is at 8. May 07 11:11:48 raspberrypi systemd[1]: Started gpt-home.service. May 07 11:11:48 raspberrypi bash[8682]: Traceback (most recent call last): May 07 11:11:48 raspberrypi bash[8682]: File "/home/ashepp/gpt-home/app.py", line 1, in May 07 11:11:48 raspberrypi bash[8682]: from functions import May 07 11:11:48 raspberrypi bash[8682]: File "/home/ashepp/gpt-home/functions.py", line 3, in May 07 11:11:48 raspberrypi bash[8682]: from dotenv import load_dotenv May 07 11:11:48 raspberrypi bash[8682]: ModuleNotFoundError: No module named 'dotenv' May 07 11:11:48 raspberrypi systemd[1]: gpt-home.service: Main process exited, code=exited, status=1/FAILURE May 07 11:11:48 raspberrypi systemd[1]: gpt-home.service: Failed with result 'exit-code'. May 07 11:11:49 raspberrypi systemd[1]: gpt-home.service: Scheduled restart job, restart counter is at 9. May 07 11:11:49 raspberrypi systemd[1]: Started gpt-home.service. May 07 11:11:49 raspberrypi bash[8684]: Traceback (most recent call last): May 07 11:11:49 raspberrypi bash[8684]: File "/home/ashepp/gpt-home/app.py", line 1, in May 07 11:11:49 raspberrypi bash[8684]: from functions import May 07 11:11:49 raspberrypi bash[8684]: File "/home/ashepp/gpt-home/functions.py", line 3, in May 07 11:11:49 raspberrypi bash[8684]: from dotenv import load_dotenv May 07 11:11:49 raspberrypi bash[8684]: ModuleNotFoundError: No module named 'dotenv' May 07 11:11:49 raspberrypi systemd[1]: gpt-home.service: Main process exited, code=exited, status=1/FAILURE May 07 11:11:49 raspberrypi systemd[1]: gpt-home.service: Failed with result 'exit-code'. May 07 11:11:49 raspberrypi systemd[1]: gpt-home.service: Scheduled restart job, restart counter is at 10. May 07 11:11:49 raspberrypi systemd[1]: gpt-home.service: Start request repeated too quickly. May 07 11:11:49 raspberrypi systemd[1]: gpt-home.service: Failed with result 'exit-code'. May 07 11:11:49 raspberrypi systemd[1]: Failed to start gpt-home.service.

judahpaul16 commented 1 week ago

@jlazerus1 Are you running the latest script? It looks like python3-venv isn't getting installed causing gpt-home.service to fail and spotifyd is not installing possibly because of permissions issues. Not sure why npm is failing to install the frontend dependencies, I'd need to see what happened right before your first screenshot. Let me see the full stdout:

./setup.sh > output.txt 2>&1
judahpaul16 commented 1 week ago

@ashepp Looks like python-dotenv fails to install at some point. What happens if you try to install requirements.txt manually?

cd ~
source gpt-home/env/bin/activate
pip install -r gpt-home/requirements.txt
gpt-restart # or sudo systemctl restart gpt-home
ashepp commented 1 week ago

I'm not entirely sure what state things are in. I am seeing the service is running. I'm assuming i just hit the IP of the raspberry pi in the browser? No port needs to be specified?

● gpt-home.service Loaded: loaded (/etc/systemd/system/gpt-home.service; enabled; preset: ena> Active: active (running) since Tue 2024-05-07 11:38:08 PDT; 7min ago Main PID: 808 (python) Tasks: 4 (limit: 1530) Memory: 288.1M (peak: 288.6M) CPU: 6min 48.491s CGroup: /system.slice/gpt-home.service └─808 python /home/ashepp/gpt-home/app.py

May 07 11:38:08 raspberrypi systemd[1]: Started gpt-home.service. May 07 11:38:15 raspberrypi bash[808]: /home/ashepp/gpt-home/app.py:73: Depreca> May 07 11:38:15 raspberrypi bash[808]: loop = asyncio.get_event_loop() May 07 11:38:15 raspberrypi bash[1061]: PING google.com (142.250.217.78) 56(84)> May 07 11:38:15 raspberrypi bash[1061]: 64 bytes from sea09s29-in-f14.1e100.net> May 07 11:38:15 raspberrypi bash[1061]: --- google.com ping statistics --- May 07 11:38:15 raspberrypi bash[1061]: 1 packets transmitted, 1 received, 0% p> May 07 11:38:15 raspberrypi bash[1061]: rtt min/avg/max/mdev = 5.963/5.963/5.96> lines 1-18/18 (END) ● gpt-home.service Loaded: loaded (/etc/systemd/system/gpt-home.service; enabled; preset: enabled) Active: active (running) since Tue 2024-05-07 11:38:08 PDT; 7min ago Main PID: 808 (python) Tasks: 4 (limit: 1530) Memory: 288.1M (peak: 288.6M) CPU: 6min 48.491s CGroup: /system.slice/gpt-home.service └─808 python /home/ashepp/gpt-home/app.py

May 07 11:38:08 raspberrypi systemd[1]: Started gpt-home.service. May 07 11:38:15 raspberrypi bash[808]: /home/ashepp/gpt-home/app.py:73: DeprecationWarning: There is no curr> May 07 11:38:15 raspberrypi bash[808]: loop = asyncio.get_event_loop() May 07 11:38:15 raspberrypi bash[1061]: PING google.com (142.250.217.78) 56(84) bytes of data. May 07 11:38:15 raspberrypi bash[1061]: 64 bytes from sea09s29-in-f14.1e100.net (142.250.217.78): icmp_seq=1> May 07 11:38:15 raspberrypi bash[1061]: --- google.com ping statistics --- May 07 11:38:15 raspberrypi bash[1061]: 1 packets transmitted, 1 received, 0% packet loss, time 0ms May 07 11:38:15 raspberrypi bash[1061]: rtt min/avg/max/mdev = 5.963/5.963/5.963/0.000 ms ~ ~ ~ ~ ~

ashepp commented 1 week ago

Ran your commands and see an error regarding 'wheel'.

Using cached PyAudio-0.2.13.tar.gz (46 kB) Installing build dependencies ... done Getting requirements to build wheel ... error error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [33 lines of output] Traceback (most recent call last): File "/home/ashepp/gpt-home/env/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in main() File "/home/ashepp/gpt-home/env/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main json_out['return_val'] = hook(**hook_input['kwargs']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ashepp/gpt-home/env/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 112, in get_requires_for_build_wheel backend = _build_backend() ^^^^^^^^^^^^^^^^ File "/home/ashepp/gpt-home/env/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 77, in _build_backend obj = import_module(mod_path) ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/importlib/init.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1387, in _gcd_import File "", line 1360, in _find_and_load File "", line 1310, in _find_and_load_unlocked File "", line 488, in _call_with_frames_removed File "", line 1387, in _gcd_import File "", line 1360, in _find_and_load File "", line 1331, in _find_and_load_unlocked File "", line 935, in _load_unlocked File "", line 995, in exec_module File "", line 488, in _call_with_frames_removed File "/tmp/pip-build-env-xl8aeo_c/overlay/lib/python3.12/site-packages/setuptools/init.py", line 16, in import setuptools.version File "/tmp/pip-build-env-xl8aeo_c/overlay/lib/python3.12/site-packages/setuptools/version.py", line 1, in import pkg_resources File "/tmp/pip-build-env-xl8aeo_c/overlay/lib/python3.12/site-packages/pkg_resources/init.py", line 2191, in register_finder(pkgutil.ImpImporter, find_on_path) ^^^^^^^^^^^^^^^^^^^ AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'? [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip. gpt-restart: command not found

jlazerus1 commented 1 week ago

I was using 1.0.0 before but I'm trying 1.0.3 now. Will get back to you. Thanks so much for being so responsive on this thread!

judahpaul16 commented 1 week ago

@brainhig moved to a new issue. See #20

judahpaul16 commented 1 week ago

@ashepp Could be related to your using python-3.12. Try with python-3.11 and rerun those commands.

sudo apt-get remove --purge python3.12
sudo apt-get update
sudo apt-get install python3.11
cd ~
source gpt-home/env/bin/activate
pip install -r gpt-home/requirements.txt
sudo systemctl restart gpt-home
ashepp commented 1 week ago

I decided to start over from scratch and now getting this error of Failed to start gpt-web.services. I have the username / pword set to ubuntu and I'm ssh'd via Putty on Win 11. I did observe some issues with wheel during the requirements script.

output.txt

jlazerus1 commented 1 week ago

I also did a fresh install and am seeing the same error with python3.12 but am having some trouble getting 3.11 installed per the above.

judahpaul16 commented 1 week ago

@jlazerus1 @ashepp Gotcha. Try getting python3.11 with pyenv:

cd ~
sudo rm -rf ~/.pyenv
curl https://pyenv.run | bash
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
pyenv install 3.11
pyenv global 3.11

Also what version Raspberry Pi are you guys using?

jlazerus1 commented 1 week ago

I'm using a Pi4. Here's an output and I stopped at pyenv install 3.11.

image
judahpaul16 commented 1 week ago

@jlazerus1 Reload your terminal to update your PATH variable:

source ~/.bash_profile

Then you should be able to run:

pyenv install 3.11
pyenv global 3.11
jlazerus1 commented 1 week ago

I'm not sure it installed properly. Do I need to install other libraries first?

image
ashepp commented 1 week ago

Thanks for the troubleshooting help. I'm also using a Raspberry Pi 4. When trying your advice on reloading the path variable by closing and relogging into the Pi. I'm getting these errors. [image: image.png]

On Wed, May 8, 2024 at 9:11 AM jlazerus1 @.***> wrote:

I'm not sure it installed properly. Do I need to install other libraries first? image.png (view on web) https://github.com/judahpaul16/gpt-home/assets/85760320/61031a55-5b6e-4c55-98fa-274d2d209a3a

— Reply to this email directly, view it on GitHub https://github.com/judahpaul16/gpt-home/issues/12#issuecomment-2100927606, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADIQZRXTBDOD6QS2QT2LFADZBJFENAVCNFSM6AAAAABEJ7OKNOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBQHEZDONRQGY . You are receiving this because you were mentioned.Message ID: @.***>

judahpaul16 commented 1 week ago

Your image didn't come through @ashepp. @jlazerus1 Hmm. Install these dependencies:

sudo apt-get update
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev \
   libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncursesw5-dev \
   xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev

And try again:

pyenv install 3.11
pyenv global 3.11
python3 --version
ashepp commented 1 week ago

Tried the above and still issues. Screenshot attached. Screenshot 2024-05-08 100106

jlazerus1 commented 1 week ago

Python installed successfully. Re-running setup now.

jlazerus1 commented 1 week ago

Looking better than before. Spotify isn't starting but I'm not so worried about that. I'm not able to get to the webpage though on port 8000. Is that the right port?

image

EDIT: I just realized that nginx is listening on port 80, but that is throwing a 502 error.

ashepp commented 1 week ago

Likewise. Got python 3.11 installed by following gpt advice below. Now starting requirements.txt install.

  1. Install Required Development LibrariesBefore attempting to install Python again, you need to install the development libraries corresponding to the missing Python extensions. Open a terminal and run the following command:

bash sudo apt-get updatesudo apt-get install -y libbz2-dev libncurses5-dev libreadline-dev libffi-dev libssl-dev

This command installs the development libraries for bzip2 (for _bz2), ncurses (for _curses), readline (for readline), libffi (for _ctypes), and OpenSSL (for _ssl).2. Install Python Using pyenvAfter installing the required libraries, proceed with the Python installation using pyenv:

bash pyenv install 3.11 pyenv global 3.11

  1. Update the PATH VariableEnsure that the pyenv initialization commands are added to your shell's configuration file (.bash_profile, .bashrc, or .zshrc, depending on the shell you are using). You've already added the necessary lines to .bash_profile, but you need to make sure they are being executed. Run:

bash source ~/.bash_profile

Or, if you are using Bash and .bash_profile does not exist or is not being sourced, you might need to add the lines to .bashrc instead:

bash echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrcecho '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrcecho 'eval "$(pyenv init -)"' >> ~/.bashrcsource ~/.bashrc

  1. Verify the InstallationAfter installation, verify that Python 3.11 is correctly installed and set as the global version:

bash python --version

On Wed, May 8, 2024 at 10:38 AM jlazerus1 @.***> wrote:

Looking better than before. Spotify isn't starting but I'm not so worried about that. I'm not able to get to the webpage though on port 8000. Is that the right port? image.png (view on web) https://github.com/judahpaul16/gpt-home/assets/85760320/67e5a72e-b818-4417-9628-8d36ff049952

— Reply to this email directly, view it on GitHub https://github.com/judahpaul16/gpt-home/issues/12#issuecomment-2101081348, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADIQZRUBAE5XYPJATI6MI5LZBJPJHAVCNFSM6AAAAABEJ7OKNOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBRGA4DCMZUHA . You are receiving this because you were mentioned.Message ID: @.***>