Reputation: 317
I want to use snakemake with fish shell and conda environments in my managed environment (basically I have no root rights and the default shell cannot be changed).
I set up fish as the 'default' shell using this hack inside the .bashrc
:
if [ "$REALBASH" != "1" ]; then
case "$-" in
*i*)
export SHELL=/usr/bin/fish
tty > /dev/null && echo "Your ~/.bashrc is switching interactive SHELL to $SHELL"
[ -x $SHELL ] && exec $SHELL "$@"
echo "Apparently $SHELL is not available here. Continuing with bash."
export SHELL=/bin/bash
;;
esac
fi
There is also a command realbash
that sets the environment variable REALBASH=1
to bypass this hack.
I managed to get conda to work with fish using this, but it has the disadvantage that within fish the command to activate conda environments is different from bash. In bash, the command is source activate ...
and in fish it is conda activate ...
.
Activating environments works both from bash using source activate ...
and from fish using conda activate ...
.
When I now execute snakemake from fish, I get the following error:
Activating conda environment ...
source: Error encountered while sourcing file “activate”:
source: No such file or directory
If I execute snakemake from bash, the same error occurs.
If I execute snakemake from bash via snakemake --overwrite-shellcmd realbash
, I get the same error and end up in the bash shell that was opened by snakemake. Only after typing exit, snakemake completes (but unsuccessfully, of course).
If I execute snakemake from fish via snakemake --overwrite-shellcmd realbash
, the same behaviour occurs.
I am confused by the behaviour of --overwrite-shellcmd
, is there a way to make this work with my hack?
Otherwise, can I configure snakemake to call conda activate
instead of source activate
?
Or is there any other solution to this?
Upvotes: 2
Views: 373
Reputation: 317
Apparently this was a bug in an older version of snakemake
. The effects described in the question were produced with snakemake 4.3.1
.
Running snakemake
from within a conda
environment where snakemake 5.17.0
is installed works perfectly fine with the setup as described in the question. No --overwrite-shellcmd
or other changes are required.
Upvotes: 1