duxenmx / E_ink_dashboard

E_paper display using raspberry pi zero showing realtime information of several topics, like weather, transit, currencies, stocks, tasklist and meetings
MIT License
70 stars 6 forks source link

Issue with running the Server #5

Closed 123tio closed 3 years ago

123tio commented 3 years ago

Hi mate,

thx for your great work. I really try to get it working for days now.

Please can you help me?

I did all the steps to run the server. This what i got as an error msg:

Dashenv.service - Gunicorn instance to serve Dashenv Loaded: loaded (/etc/systemd/system/Dashenv.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Tue 2020-12-08 12:32:38 CET; 17s ago Process: 1042 ExecStart=/usr/local/bin/gunicorn --workers 3 --bind unix:Dashenv.sock -m 007 wsgi:app (code=exited, status=1/FAILURE) Main PID: 1042 (code=exited, status=1/FAILURE)

Dez 08 12:32:25 raspberrypi systemd[1]: Started Gunicorn instance to serve Dashenv. Dez 08 12:32:33 raspberrypi gunicorn[1042]: [2020-12-08 12:32:33 +0000] [1042] [INFO] Starting gunicorn 19.10.0 Dez 08 12:32:33 raspberrypi gunicorn[1042]: [2020-12-08 12:32:33 +0000] [1042] [ERROR] Retrying in 1 second. Dez 08 12:32:34 raspberrypi gunicorn[1042]: [2020-12-08 12:32:34 +0000] [1042] [ERROR] Retrying in 1 second. Dez 08 12:32:35 raspberrypi gunicorn[1042]: [2020-12-08 12:32:35 +0000] [1042] [ERROR] Retrying in 1 second. Dez 08 12:32:36 raspberrypi gunicorn[1042]: [2020-12-08 12:32:36 +0000] [1042] [ERROR] Retrying in 1 second. Dez 08 12:32:37 raspberrypi gunicorn[1042]: [2020-12-08 12:32:37 +0000] [1042] [ERROR] Retrying in 1 second. Dez 08 12:32:38 raspberrypi gunicorn[1042]: [2020-12-08 12:32:38 +0000] [1042] [ERROR] Can't connect to Dashenv.sock Dez 08 12:32:38 raspberrypi systemd[1]: Dashenv.service: Main process exited, code=exited, status=1/FAILURE Dez 08 12:32:38 raspberrypi systemd[1]: Dashenv.service: Failed with result 'exit-code'.

After installing Gunicorn i could find the Gunivcron file in the directory you named. So placed the default value to it:

GNU nano 3.2 /etc/systemd/system/Dashenv.service

[Unit] Description=Gunicorn instance to serve Dashenv After=network.target

[Service] User=pi Group=www-data WorkingDirectory=/home/pi/E_ink_dashboard/www Environment="PATH=/home/pi/E_ink_dashboard/www/Dashenv/bin" ExecStart=gunicorn --workers 3 --bind unix:Dashenv.sock -m 007 wsgi:app

[Install] WantedBy=multi-user.target

Do you have an idea what im doing wrong?

duxenmx commented 3 years ago

Hey there lets try a few things to see where the error might be 1- try running your webserver in flask development server, "python3 webserver.py" 2- check if gunicorn is working by typing the command "gunicorn --bind 0.0.0.0:5000 wsgi:app" 3- if your username is different from pi you will need to modify the user field in the service file 4- be sure to do the virtual environment step from the guide, once done you should have the folder of the virtual environment in "/home/pi/E_ink_dashboard/www/", match the cases as well on your service file

from what I see in the error "Process: 1042 ExecStart=/usr/local/bin/gunicorn --workers 3 --bind unix:Dashenv.sock -m 007 wsgi:app (code=exited, status=1/FAILURE)" is not using your virtual environment files

let me know if this helps

123tio commented 3 years ago

Hey there lets try a few things to see where the error might be 1- try running your webserver in flask development server, "python3 webserver.py" 2- check if gunicorn is working by typing the command "gunicorn --bind 0.0.0.0:5000 wsgi:app" 3- if your username is different from pi you will need to modify the user field in the service file 4- be sure to do the virtual environment step from the guide, once done you should have the folder of the virtual environment in "/home/pi/E_ink_dashboard/www/", match the cases as well on your service file

from what I see in the error "Process: 1042 ExecStart=/usr/local/bin/gunicorn --workers 3 --bind unix:Dashenv.sock -m 007 wsgi:app (code=exited, status=1/FAILURE)" is not using your virtual environment files

let me know if this helps

Thats great. Thx for your quick response. I tried to deploy the gunicorn file within my dashenv/bin dir. But unfortunately i got an error while installing the gunicorn and flask files: image

What am i missing?

duxenmx commented 3 years ago

try installing from the www folder and dont use sudo when installing

123tio commented 3 years ago

Allright, I tried. Still no gunicorn file: image

duxenmx commented 3 years ago

mmmm, from what I see not even flask got installed in the folder, sorry if I'm repeating things you probably already did, it's how I troubleshoot things.

-deactivate the environment with "deactivate" -go to the www folder then activate the environment "source dashenv/bin/activate" -pip install gunicorn flask wheel

123tio commented 3 years ago

Again: thank you very mutch fpr your patient and help. Finally i could install gunicorn by forcing to install it in the right directory. Credits goes to: https://stackoverflow.com/questions/26476607/how-do-you-specify-bin-directory-for-pip-install-with-target-option-enabled

But now i got a new error when i try to start: image

duxenmx commented 3 years ago

there is a /bin/bin/ in your exec start, check if you have that directory in the service file for the enviro variable

123tio commented 3 years ago

So.... I did a compl. new run. I used a compl. new sd card and firstly run your requirements script. It went threw (beside line 20).

And after that... The same error msg again: image

Once again i tried to force him to install in the directory. But no chance. The install break down: image

I think i'm out of options here. Seems that many users have a similar problem: https://stackoverflow.com/questions/23928213/how-to-get-gunicorn-to-use-python-3-instead-of-python-2-502-bad-gateway

duxenmx commented 3 years ago

I'm gonna try to do a fresh install in an extra pi zero I have around and will try to replicate your problem, I'll let you know as soon as I can

duxenmx commented 3 years ago

back now, so.... I did a fresh install, on a fresh rpi zero that didnt had anything, followed the steps to install everything for the webserver and didnt had any errors, didnt had to force anything at all, and the server is up and running now.

-did you installed the libraries from step 1? sudo apt update sudo apt install python3-pip python3-dev build-essential libssl-dev libffi-dev python3-setuptools

-check whats the version for your python3 with "python3 --version", if it is 3.7.x you should do -python3.7 -m venv dashenv -otherwise try whatever version is your python 3

one 2

123tio commented 3 years ago

Iäm loosing my mind right now. When i try to install the pilot, its working totally fine: image

Do you think it has something to do with permission issues?

BTW: its amazing how kindly your helping my out of this noobish probem

123tio commented 3 years ago

In your screens the project is called "e_paper_dashboard". Is this important? I read in your service files that you have a different name as for the project but you just named it differently, right?

duxenmx commented 3 years ago

no problem at all, I did struggled quite a bit when I was learning how to do it from the tutorial

-I dont think it's a permission issue, when I did this test it was in a different pi, installed everything from scratch and copy pasted the project folder to it, but you could always try change the permissions

-the project name doesnt matter as long as it match in the directories you state in the service files, for the name of the service I just grabbed the one from the example (myproject) and worked fine

why dont you try this, create your folders, "e_dashboard/www/" as you created the "myproject" folder, do your virtual environment installations, if everything works fine, pass the contents from www to your newly created www folder and check if it runs there

123tio commented 3 years ago

Dude, that crushed it. Nice idea. It worked. I'm finally able to enter the config file: image After creating all the API's, i clicked on "submit". But then i get redirected to an error page: image Can you help once more?

123tio commented 3 years ago

Oh sry. I found my mistake. I didnt modify the settings.html image

duxenmx commented 3 years ago

thats awesome!, glad its finally working, remember there is another place where you also need to change your ip address, in case you havent changed it already

STEP 5 of the tutorial server { listen 80; server_name localhost your_ip_address;

location / { include proxy_params; proxy_pass http://unix:/home/pi/e_paper_dashboard/www/Dashweb.sock; } }

If everything is working good, I'll go ahead and close the issue

123tio commented 3 years ago

I'm feeling like beeing so close to the finish line. I could execute the dashboard.py and then my pi crash... The screen of my dash is still in testmode. image

123tio commented 3 years ago

i'm running out of options again. when i try to start the dash from my env it doesnt crash but throw an error like this: image

Do you know this kind of error?

duxenmx commented 3 years ago

that's because your env probably doesnt have google api libraries, try installing them there

pip install --upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib

for when you are not in the env and tried running it, did it just got stuck there?, sometimes it takes a bit of time to load things in the beginning but after a bit you start seeing the screen refreshing

123tio commented 3 years ago

No chance. I tried: image

Every time i try without env its crashing.

Is there a way to deactivate google calender at the beginning?

duxenmx commented 3 years ago

yeah, in the system area of your config web page you can select which module to use or turn it off, calendar is in module 3 I think

duxenmx commented 3 years ago

for the google calendar you can give it a try with this example to see if it works by itself

https://developers.google.com/calendar/quickstart/python

123tio commented 3 years ago

too bad. icant deactivate the calender...

the calender test works perfectöy fine. for some reason my *.py files in /home/pi/e_ink/e_ink/lib/python3.7/site-packages/googleapiclient where compl. e,pty. so i copied the sourcecode in there by myself. but still... after starting my dash the pi dies :(

duxenmx commented 3 years ago

you can comment line 12 and line 194 on the dashboard.py to remove the calendar

-try turning off all the modules from the config web page and then work one by one to see of something is giving you a problem

does the example code from waveshare works fine when you load the example script? https://www.waveshare.com/wiki/7.5inch_e-Paper_HAT

123tio commented 3 years ago

After your msg i tested the waveshare example again and it crashed. Before it worked just fine. So there has to be the problem. I try to reinstall the waveshare repos. Maybe it helps.

123tio commented 3 years ago

Dude it's amazing. After trieing and wimmering for hours, i'm now finally able to start the dashboard. Things seems to be loading. I'm celebreting right now. I think i have one problem left dealing with time date... image

123tio commented 3 years ago

Thx to adrian i could handle my installation problem. At the end the problem was to reinstall pip with:

python3 -m pip install --upgrade pip python3 -m pip install --upgrade Pillow

After that the dashboard could start.

Thx to Adrian for the awesome support!

Issue can be closed

duxenmx commented 3 years ago

Awesome, I'm glad it's finally working for you! Enjoy the project!

Closing the issue