Galaxy not using the newly created environment for tool execution.

Hello,
I’m running a local galaxy installation, on a new computer running Ubuntu 20.04.
I have written some tools and uploaded them using planemo. This is an example of the simplest tool:

<tool id="Toy" name="Toy app" version="0.1.0">
  <description>Toy</description>
<requirements>
    <requirement type="package" version="3.7.6">python</requirement>
    <requirement type="package">seaborn</requirement>

</requirements>
<command detect_errors="exit_code"><![CDATA[
    python $__tool_directory__/testtoy.py '$argument' > '$output'
]]></command>
<inputs>
    <param type="data" name="argument" label="test argument" format="txt" />
</inputs>
<outputs>
    <data name="output" format="txt" label="${tool.name} on ${on_string}: Toy output"/>
</outputs>
<help><![CDATA[
    No help
]]></help>
<citations>
    <citation type="bibtex">
    </citation>
</citations>
</tool>

As you can see, seaborn is required. When I proceed to install this tool in my local galaxy, it successfully creates a “mulled” conda environment containing all the needed dependencies. If activated manually, the environment works ok.

When I launch the tool using the galaxy interface, it ends up in error saying “No module named seaborn”.
I investigated a little more by stopping a job in the middle and looking inside the job folder, where I can find tool_script.sh which contains the main commands (environment activation and script execution) and galaxy_221.sh that wraps the latter.
When executed manually from a bash console, this happens:

  • If I execute tool_script.sh alone, it works. It uses the python inside the mulled environment, all dependencies are met. Output is produced.
  • If I execute galaxy_221.sh, it gives me the infamous “ModuleNotFound error” described above. And for a good reason: it uses galaxy/.venv/bin/python, which of course doesn’t have seaborn installed.

So the galaxy_221.sh wrapper somehow ignores the correct environment and reverts to the standard python. Is there a reason for this, and a way to correct this behaviour?

Link to tool_script.sh: here
Link to galaxy_221.sh: here

Ok solved. It was because I was running galaxy from the base environment of my system-installed conda.
Still don’t really get the real reason, but if I deactivate everything and run galaxy from base bash, everything works.