Are you perhaps using a supervisor setup where you are setting the PATH ?
In that case you can remove /phengs/hpc_storage/home/galaxy_hpc/galaxy-dist/.venv/bin from the PATH.
If you're referencing python you can directly use the path to /phengs/hpc_storage/home/galaxy_hpc/galaxy-dist/.venv/bin/python.

Best,
Marius

On 25 October 2017 at 18:24, Ulf Schaefer <ulf.schaefer@phe.gov.uk> wrote:
Hi Marius

This is very useful, but not quite there.

I use in my job_conf.xml

<destination id="uge_default" runner="uge">
    <env id="PATH">/this/is/a/test</env>
</destination>

and I end up with this

PATH=/phengs/hpc_storage/home/galaxy_hpc/galaxy-dist/.venv/bin:/this/is/a/test

Any idea where that came from?

Thanks
Ulf

On 25/10/17 16:05, Marius van den Beek wrote:
Hi Ulf,

you can set a virtualenv to be used in your job_conf.xml file.
The following line would go into the `<destination></destination>` tag:
`<env file="path_to_venv/bin/activate" />`

Best,
Marius


On 25 October 2017 at 16:56, Ulf Schaefer <ulf.schaefer@phe.gov.uk
<mailto:ulf.schaefer@phe.gov.uk>> wrote:

    Hi again

    Update, sorry for spamming:

    It is not ALL jobs that fail. Only the ones that get dispatched to
    our Grid Engine cluster (so nearly all).

    The reason appears to be that the path to the Python binary is added
    to the PATH variable when the job arrives on the worker node:

    [galaxy_hpc@hpc1node25 galaxy-dist]$ export
    PATH=/home/galaxy_hpc/galaxy-dist/.venv/bin:/tmp/5000354.1.researchmid.q:/usr/local/bin:/bin:/usr/bin
    [galaxy_hpc@hpc1node25 galaxy-dist]$ python
    Could not find platform dependent libraries <exec_prefix>
    Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
    Python 2.7.6 (default, Oct 25 2017, 12:28:23)
    [GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import json
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ImportError: No module named json

    This is the wrong python to be running there. It should just go with
    the one in /usr/bin. If I change PATH, it works fine:

    [galaxy_hpc@hpc1node25 galaxy-dist]$ export
    PATH=/tmp/5000354.1.researchmid.q:/usr/local/bin:/bin:/usr/bin[galaxy_hpc@hpc1node25
    galaxy-dist]$ python
    Python 2.6.6 (r266:84292, Aug  9 2016, 06:11:56)
    [GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import json
    >>>

    Does anyone have an idea how I can stop this from happening? Where
    is the PATH set before submitting the job?

    Thanks
    Ulf






    On 25/10/17 15:23, Ulf Schaefer wrote:

        Hi all

        After running the recommended update I am now on branch 17.09.
        As part
        of the update I set up a new virtual env running an additional
        python
        2.7.6. My previous virtual env was running 2.6.6 which is a system
        requirement for Centos 6.

        All dependencies were installed and Galaxy starts fine, but no tools
        run. The error is always a variation of this:

        Could not find platform dependent libraries <exec_prefix>
        Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
        Traceback (most recent call last):
          File
        "galaxy-dist/database/jobs_directory/000/418/418014/set_metadata_4LcsZv.py",
        line 1, in <module>
            from galaxy_ext.metadata.set_metadata import set_metadata;
        set_metadata()
          File "galaxy-dist/lib/galaxy_ext/metadata/set_metadata.py",
        line 19,
        in <module>
            import json
        ImportError: No module named json

        I put some debug output at the top of set_metadata.py and it is
        indeed
        running the correct python version from the virtual env.
        Needless to say
        I can import json just fine using that python version. Any ideas?

        Any help is greatly appreciated.

        Thanks
        Ulf


    **************************************************************************
    The information contained in the EMail and any attachments is
    confidential and intended solely and for the attention and use of
    the named addressee(s). It may not be disclosed to any other person
    without the express authority of Public Health England, or the
    intended recipient, or both. If you are not the intended recipient,
    you must not disclose, copy, distribute or retain this message or
    any part of it. This footnote also confirms that this EMail has been
    swept for computer viruses by Symantec.Cloud, but please re-sweep
    any attachments before opening or saving. http://www.gov.uk/PHE
    **************************************************************************
    ___________________________________________________________
    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/ <https://lists.galaxyproject.org/>

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



**************************************************************************
The information contained in the EMail and any attachments is confidential and intended solely and for the attention and use of the named addressee(s). It may not be disclosed to any other person without the express authority of Public Health England, or the intended recipient, or both. If you are not the intended recipient, you must not disclose, copy, distribute or retain this message or any part of it. This footnote also confirms that this EMail has been swept for computer viruses by Symantec.Cloud, but please re-sweep any attachments before opening or saving. http://www.gov.uk/PHE
**************************************************************************