systemd service

I created a service to run my webapp using the Systemd method.  When I was trying to run the app.py file I got this error saying that ‘sqlalchemy’ module could not be found.  I kept trying to install it in many different ways.  The final solution was to make sure I installed in for my python 3 environment and make sure I install all the packages using sudo and then run the application as sudo.

install package using sudo:
     sudo python3 -m pip install sqlalchemy

 

The .service file looks something like:

[Unit]
Description=HomeBase
After=multi-user.target

[Service]
Type=idle
ExecStart=/usr/bin/python3 /BaseWebApp/webapp/app.py > /BaseWebApp/webapp/application.log 2>&1

[Install]
WantedBy=multi-user.target

There really is no reason to expect that the file being run is will be run be root (or it just isn’t apparent)