title: Snakemake: I keep getting The 'conda' command is not available in $PATH. when running on SGE cluster
body: <p>I'm tearing my hair out here, hopefully someone can help me.</p>
  
  <p>Running snakemake 4.8.0</p>
  
  <p>I have a snakemake pipeline, which I run with two conda envs and --use-conda and it works fine when run as a standalone pipeline.</p>
  
  <p>However, when I run on our cluster, I get the error:</p>
  
  <p>"The 'conda' command is not available in $PATH."</p>
  
  <p>Now.  Anaconda is installed on our cluster, but we need to activate it on nodes with:</p>
  
  <pre><code>module load anaconda
  </code></pre>
  
  <p>Also, module is defined as a function, so I have source a couple of things first.  Therefore, at the top of my snakefile, I have:</p>
  
  <pre><code>shell.prefix("source $HOME/.bashrc; source /etc/profile; module load anaconda; )
  </code></pre>
  
  <p>This doesn't solve the problem.</p>
  
  <p>I even put <code>module load anaconda</code> in my <code>.bashrc</code>, and that still doesn't work.  Only on cluster execution, I get the error about conda not being found.</p>
  
  <p>Other changes to my <code>.bashrc</code> are picked up and are picked up by snakemake, so I have no idea why it is having problems with conda.</p>
  
  <p>I even created a conda env, loaded snakemake and conda into that env, activate the env in the submission script and in the Snakefile:</p>
  
  <pre><code>shell.prefix("source $HOME/.bashrc; source /etc/profile; module load anaconda; source activate MAGpy-3.5; ")
  </code></pre>
  
  <p>And it <em>still</em> says "The 'conda' command is not available in $PATH."</p>
  
  <p>Literally tearing my hair out.</p>
  
  <p>As an aside, I submit using <code>qsub -S /bin/bash</code> and also use <code>shell.executable("/bin/bash")</code> but the temp shell scripts created in <code>.snakemake</code> are run by <code>/bin/sh</code> - is that expected?</p>
  
  <p>Please help me!</p>