Carlus
Carlus

Reputation: 71

using conda environments in simple snakemake workflows

I am wondering how to best - or simplest - use snakemake in conjunction with conda. I am aware of the "--use-conda" option with a yaml-file per rule. However, for a simple snakemake workflow I think it would be easier to just (i) activate a single, existing conda environment, (ii) run the snakemake workflow and (iii) deactivate the environment again.

Upvotes: 4

Views: 1129

Answers (1)

TBoyarski
TBoyarski

Reputation: 441

From my experiences in a Linux environment (Redhat // CentOS) it was very convenient to set a local alias that starts a conda environment, calling it right when you login, and to then work within and run everything from that conda environment.

Works great with the Linux screen functionality.

To run a large batch production, I will use a screen (Linux) and it will quickly copy the existing environment (the conda environment will thus already be loaded) into a new screen. That way you can close the window and still work elsewhere. I found no issues with running the same conda environment (E.g. "source activate myCondaEvn-2017") from 5 or more different terminal sessions.

I always used conda to manage anything running Snakemake. But I actually never needed to use the --conda call in production. It is possible to nest conda environments, however, the cost of creating a conda environment for each rule (when I had 100's of rules) is too costly. It did allow me to run Python 2 and Python 3 simultaneously, but I actually never used software which required this.

Upvotes: 2

Related Questions