title: How to use environment modules in a ssh command line?
body: <p>The <strong>Environment Modules</strong> package is used for dynamic modification of a user's environment (<em>debian package</em> <code>environment-modules</code>).</p>
  
  <p>I would like to use <code>module</code> directly from a <code>ssh</code> command line. The purpose is to be able to execute commands on different nodes from a bash script executed on a front node. I don't want to explicitly update <code>PATH</code> and <code>LD_LIBRARY_PATH</code> environment variables for each different node configuration.</p>
  
  <p>When I directly connect to the node and then call <code>module</code> from the node, it is obviously working:</p>
  
  <pre><code>jyvet&gt; ssh mynode
  jyvet@mynode&gt; module load gcc-6.0
  jyvet@mynode&gt; gcc --version
  gcc (GCC) 6.0.1
  </code></pre>
  
  <p>But the following approach fails:</p>
  
  <pre><code>jyvet&gt; ssh mynode "module load gcc-6.0; gcc --version"
  command not found: module
  gcc-4.8 (Debian 4.8.4-1) 4.8.4
  </code></pre>