Reputation: 323
I have a simple Snakefile and I have a rule that use Conda enviroment defined in YAML configuration file.
However, when running this Snakefile, Snakemake does not activate the Conda enviroment and returns this error:
Error in rule read_file:
jobid: 0
conda-env: /data/projects/testproject/.snakemake/conda/805d8d2a
RuleException:
CalledProcessError in line 5 of /data/projects/testproject/scripts/snake/process.snake:
Command 'source activate /data/projects/testproject/.snakemake/conda/805d8d2a; set -euo pipefail; emirge ' returned non-zero exit status 2
File "/data/projects/testproject/scripts/snake/process.snake", line 5, in __rule_read_file
File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
Shutting down, this might take some time.
Exiting because a job execution failed. Look above for error message
I tried to activate Conda enviroment (the one created by SnakeMake) manually by using both source activate 805d8d2a
and conda activate 805d8d2a
with no success (error message implies that there is no enviroment with said name, however, conda info --envs
lists it as existing). To further test Conda functionality, I have manually created a Conda enviroment and was able to activate it with the latter command (command source activate testenv
does not work).
My question is: How can I manage to automatically activate Conda enviroment from my SnakeMake script?
Conda version: 4.5.11
SnakeMake version: 5.2.4
Snakefile:
rule my_rule:
conda:
"emirge.yaml"
shell:
"emirge"
Emirge.yaml:
channels:
- bioconda
dependencies:
- emirge=0.61.1
Edit:
I am running Snakemake with command:
snakemake --use-conda
Upvotes: 0
Views: 3610
Reputation: 3368
You have to tell snakemake to use conda on the command line:
snakemake --use-conda
The doc states:
CONDA:
--use-conda
If defined in the rule, run job in a conda environment. If this flag is not set, the conda directive is ignored.
The error you're having is because the shell command you're running does not exist.
Snakemake executes the command
source activate /data/projects/testproject/.snakemake/conda/805d8d2a; set -euo pipefail; emirge
I think your environment is correctly created and activated but it is the command emirge
that is not found.
Upvotes: 1