Skip to content

Instantly share code, notes, and snippets.

@brainstorm brainstorm/pcgr.service
Last active Oct 22, 2019

Embed
What would you like to do?
systemd with python3 virtualenv does not find modules
(venv) ubuntu@localhost:/etc/systemd/system$ sudo cat pcgr.service
[Unit]
Description=PCGR sample consumer process
After=network-online.target
[Service]
Type=simple
WorkingDirectory=/home/ubuntu
ExecStart=/mnt/pcgr/venv/bin/python3 /mnt/pcgr/pcgr_consumer.py pcgr ap-southeast-2 pcgr 10 10 /home/ubuntu
[Install]
WantedBy=multi-user.target
Feb 27 18:15:28 localhost python3[14386]: Traceback (most recent call last):
Feb 27 18:15:28 localhost python3[14386]: File "/mnt/pcgr/pcgr.py", line 12, in <module>
Feb 27 18:15:28 localhost python3[14386]: import toml
Feb 27 18:15:28 localhost python3[14386]: ImportError: No module named toml
Feb 27 18:15:28 localhost python3[14386]: Traceback (most recent call last):
Feb 27 18:15:28 localhost python3[14386]: File "/mnt/pcgr/pcgr_consumer.py", line 193, in <module>
Feb 27 18:15:28 localhost python3[14386]: main()
Feb 27 18:15:28 localhost python3[14386]: File "/mnt/pcgr/pcgr_consumer.py", line 179, in main
Feb 27 18:15:28 localhost python3[14386]: process(sample_name)
Feb 27 18:15:28 localhost python3[14386]: File "/mnt/pcgr/pcgr_consumer.py", line 80, in process
Feb 27 18:15:28 localhost python3[14386]: log.info(subprocess.check_output(str2subpr))
Feb 27 18:15:28 localhost python3[14386]: File "/usr/lib/python3.6/subprocess.py", line 336, in check_output
Feb 27 18:15:28 localhost python3[14386]: **kwargs).stdout
Feb 27 18:15:28 localhost python3[14386]: File "/usr/lib/python3.6/subprocess.py", line 418, in run
Feb 27 18:15:28 localhost python3[14386]: output=stdout, stderr=stderr)
Feb 27 18:15:28 localhost python3[14386]: subprocess.CalledProcessError: Command '['/mnt/pcgr/pcgr.py', '--force_overwrite', '--input_vcf', 'cup_tissue-5cba4a-germline.vcf.gz', '/mnt/pcgr', 'cup_tissue-5cba4a-germline-output', 'cup_tissue-5cba4a-germline.toml', 'cup_ti
Feb 27 18:15:28 localhost systemd[1]: pcgr.service: Main process exited, code=exited, status=1/FAILURE
Feb 27 18:15:28 localhost systemd[1]: pcgr.service: Unit entered failed state.
Feb 27 18:15:28 localhost systemd[1]: pcgr.service: Failed with result 'exit-code'.
Feb 27 18:15:31 localhost sudo[14418]: ubuntu : TTY=pts/0 ; PWD=/etc/systemd/system ; USER=root ; COMMAND=/usr/sbin/service pcgr status
Feb 27 18:15:31 localhost sudo[14418]: pam_unix(sudo:session): session opened for user root by ubuntu(uid=0)
Feb 27 18:15:36 localhost sudo[14418]: pam_unix(sudo:session): session closed for user root
ubuntu@localhost:/etc/systemd/system$ source /mnt/pcgr/venv/bin/activate
(venv) ubuntu@localhost:/etc/systemd/system$ python -c "import toml"
(venv) ubuntu@localhost:/etc/systemd/system$ which python
/mnt/pcgr-0.5.3/venv/bin/python
(venv) ubuntu@localhost:/etc/systemd/system$ which python3
/mnt/pcgr-0.5.3/venv/bin/python3
@brunetton

This comment has been minimized.

Copy link

brunetton commented Oct 21, 2019

Did you finally find a workaround ? Thanks

@brainstorm

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.