My Linux service runs a script that produces an error that a module is not found.
However, when I run the script from the terminal with the python environment activated the script works fine.
I run the script in the terminal with the exact same environment /home/nick/environments/social_agg/bin/python
activated and this is referenced in my .service file.
I believe my problem is the environments (1-terminal and 2-service file) are different somehow. I’ve created many service files similarly -- adding python packages to the venv referenced in ExecStart= /home/nick/environments/social_agg/bin/python
of the .service file has never been a problem so I assumed the same environments were being used.
Here is the github repo for goodreads-user-scraper package that is not being recognized. Could there be something about this package since it runs from the terminal that makes it different than other python packages?
Any thoughts at all on how to approach this would be great. At this point I'm not really sure where to look next.
Error
Jan 13 17:30:25 speedypersonal2 python[17585]: /bin/sh: 1: goodreads-user-scraper: not found
socialAggregator.service
[Unit]
Description=Run Social Aggregator --- DEVELOPMENT ---
After=network.target
[Service]
User=nick
ExecStart= /home/nick/environments/social_agg/bin/python /home/nick/applications/socialAggregator/scheduler.py --serve-in-foreground
[Install]
WantedBy=multi-user.target
- update 2023-01-15 working service *
[Unit]
Description=Run Social Aggregator scheduler - collect data from API's and store in socialAggregator Db --- DEVELOPMENT ---
After=network.target
[Service]
User=nick
ExecStart= /home/nick/environments/social_agg/bin/python /home/nick/applications/socialAggregator/scheduler.py --serve-in-foreground
Environment=PATH=/home/nick/environments/social_agg/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
[Install]
WantedBy=multi-user.target