Hi All,

when my local galaxy is started using the init system (systemd on Ubuntu
16.04 in this instance).  Some tools will fail, indicating that some
python module do not exist.  This is the result of uploading a 2KB plain
text file:

Traceback (most recent call last):
 File "/home/galaxy/galaxy/tools/data_source/upload.py", line 20, in <module>
   from galaxy.datatypes import sniff
 File "/home/galaxy/galaxy/lib/galaxy/datatypes/sniff.py", line 31, in <module>
   from galaxy.datatypes.binary import Binary
 File "/home/galaxy/galaxy/lib/galaxy/datatypes/binary.py", line 14, in <module>
   import pysam
ImportError: No module named pysam
Traceback (most recent call last):
 File "/home/galaxy/galaxy/database/jobs_directory/000/39/set_metadata_EI05GD.py", 
line 1, in <module>
   from galaxy_ext.metadata.set_metadata import set_metadata; set_metadata()
 File "/home/galaxy/galaxy/lib/galaxy_ext/metadata/set_metadata.py", line 23, in 
<module>
   from sqlalchemy.orm import clear_mappers
ImportError: No module named sqlalchemy.orm

When the same galaxy install is started directly using the 'run.sh'
script in the install directory, everything works fine.

I've verified that I can manually import pysam and sqlalchemy.orm if I
execute the python interpreter located at <install_dir>/.venv/bin/python
directly.

Any ideas?

I've attached the init script.

TL;DR

Galaxy cannot import some python modules when started by the init
system. No idea why.

Galaxy version: 17.05
OS: Ubuntu 16.04


Many Thanks

Max


--------------------------------------------------------------------
Un o’r 4 prifysgol uchaf yn y DU a’r orau yng Nghymru am fodlonrwydd myfyrwyr.
(Arolwg Cenedlaethol y Myfyrwyr 2016)
www.aber.ac.uk

Top 4 UK university and best in Wales for student satisfaction
(National Student Survey 2016)
www.aber.ac.uk
#!/bin/bash

# Author: James Casbon, 2009

### BEGIN INIT INFO
# Provides:             galaxy
# Required-Start:       $network $local_fs $mysql
# Required-Stop:
# Default-Start:        2 3 4 5
# Default-Stop:         0 1 6
# Short-Description:    Galaxy
### END INIT INFO

. /lib/lsb/init-functions

USER="galaxy"
GROUP="nogroup"
GALAXY_DIR="/home/galaxy/galaxy/"
# Galaxy releases >= 16.01 installs dependencies by default into a virtualenv 
in <GALAXY_DIR>/.venv
# A simple way to activate this virtualenv is to use the python interpreter in 
<GALAXY_DIR>/.venv
# See https://wiki.galaxyproject.org/News/2016_01_GalaxyRelease and
# 
https://github.com/galaxyproject/galaxy/blob/dev/doc/source/admin/framework_dependencies.rst
PYTHON="/home/galaxy/galaxy/.venv/bin/python"
OPTS="./scripts/paster.py serve --log-file /home/galaxy/galaxy.log 
config/galaxy.ini"
PIDFILE="/var/run/galaxy.pid"

case "${1:-''}" in
  'start')
           log_daemon_msg "Starting Galaxy"
           if start-stop-daemon --chuid $USER --group $GROUP --start 
--make-pidfile \
                     --pidfile $PIDFILE --background --chdir $GALAXY_DIR --exec 
$PYTHON -- $OPTS; then
             log_end_msg 0
           else
             log_end_msg 1
           fi

        ;;
  'stop')
           log_daemon_msg "Stopping Galaxy" 
           if start-stop-daemon --stop --pidfile $PIDFILE; then
             log_end_msg 0
           else 
             log_end_msg 1
           fi
        ;;
  'restart')
           # restart commands here
           $0 stop
           $0 start
                           
        ;;
  *)      # no parameter specified
        echo "Usage: $SELF start|stop|restart|reload|force-reload|status"
        exit 1
        ;;
esac



___________________________________________________________
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:
  https://lists.galaxyproject.org/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/

Reply via email to