Running Python script via systemd fails to load module
<p>I have a Python script that uses <code>zmq</code> and I've installed this library via <code>pip install zmq</code> and I can run the program fine if called manually via the command line. However as soon as I attempt to have a <code>systemd</code> unit call the script, running <code>systemctl status myservice.service</code> shows <code>ImportError: No module named zmq</code>.</p>

<p>My service file looks like this:</p>

<pre><code>[Unit]
Description=Does Something

[Service]
Type=simple
ExecStart=/bin/sh /var/lib/project/runpythonscript.sh
Restart=always

[Install]
Alias=myservice.service
</code></pre>

<p>Where <code>runpythonscript.sh</code> 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 <code>zmq</code> module.</p>

<p>Any help is appreciated.</p>