pirovc
pirovc

Reputation: 11

How to get the conda environment path inside a rule?

On previous versions of Snakemake (tested on 3.9.1 using integration with bioconda --use-conda) I could just check for the md5 hash of the environment.yaml file and find the respective environment at: workdir/.snakemake/conda/md5

On version 4.3.0 the md5 hash of the file does not match the environment folder. Looking at the source code I found out that the full path of the environment file is included when calculating the md5 hash to avoid conda errors on hard-coded paths but I am not sure how to generate the correct hash.

Is there another easier way to get the environment path inside a rule? If not, how can I generate the correct md5 to finde the environment?

Upvotes: 1

Views: 544

Answers (1)

Johannes Köster
Johannes Köster

Reputation: 1947

Currently, the only reasonable way is to check the log. The path is displayed when the environment is activated. However, it is a very good idea to provide a command line option to list all environments, something like snakemake --list-conda-envs. I will do that as soon as possible.

EDIT: I have implemented --list-conda-envs in the master branch. It will be in the next release.

Upvotes: 1

Related Questions