I understood from the Snakemake docs that the conda
directive can take the name of an existing conda environment. However, I am faced with the error EnvironmentNameNotFound: Could not find conda environment
. Why can Snakemake not find the existing conda environment? Please see my example below. I am using Miniconda3 and Snakemake v7.19.1, through Ubuntu 20.04 on WSL2.
My Snakefile contains:
rule test:
output: temp("test.txt")
conda: "test-env"
shell: "touch {output}"
The test-env
environment was created as follows:
conda create -n test-env -y
Running conda info --envs
shows that test-env
exists: test-env /home/elh605/miniconda3/envs/test-env
.
My snakemake command and the full output:
snakemake -j1 --use-conda
Building DAG of jobs...
Using shell: /usr/bin/bash
Provided cores: 1 (use --cores to define parallelism)
Rules claiming more threads will be scaled down.
Job stats:
job count min threads max threads
----- ------- ------------- -------------
test 1 1 1
total 1 1 1
Select jobs to execute...
[Tue Jan 10 19:28:50 2023]
rule test:
output: test.txt
jobid: 0
reason: Missing output files: test.txt
resources: tmpdir=/tmp
Activating conda environment: test-env
EnvironmentNameNotFound: Could not find conda environment: test-env
You can list all discoverable environments with `conda info --envs`.
[Tue Jan 10 19:28:52 2023]
Finished job 0.
1 of 1 steps (100%) done
Removing temporary output test.txt.
Complete log: .snakemake/log/2023-01-10T192850.160679.snakemake.log
I tried using the --conda-prefix
option to point Snakemake to my base conda environment, however Snakemake still could not activate test-env
. How can I tell Snakemake where to find test-env
?