I have a Python script that uses zmq
and I've installed this library via pip install zmq
and I can run the program fine if called manually via the command line. However as soon as I attempt to have a systemd
unit call the script, running systemctl status myservice.service
shows ImportError: No module named zmq
.
My service file looks like this:
[Unit]
Description=Does Something
[Service]
Type=simple
ExecStart=/bin/sh /var/lib/project/runpythonscript.sh
Restart=always
[Install]
Alias=myservice.service
Where runpythonscript.sh
is a very simple shell script that runs my python script as root. Running this shell script manually from the command line runs my python program completely fine but having the service call it causes it to not locate the zmq
module.
Any help is appreciated.