Attempting to shell out commands in sequence through python subprocess
<p>Im attempting to run virtualenv and install packages through pip locally. When running the below routine no output is being given to give me any indication as to why its failing. I am trying to do something similar to the following</p>

<p><code>source env/bin/activate</code></p>

<p><code>(env) pip install [packages]</code></p>

<p>I can do it with <code>Popen("source env/bin/activate &amp;&amp; pip install package", shell=True)</code> but what hoping to handle it in the way I have it defined in my routine.</p>

<p>Any ideas?</p>

<pre><code>def install_pkgs(self):
    proc = subprocess.Popen(["source %s" % (os.path.join(self._commons['dst_dir'], 'env/bin/activate'),)],
                            stdin=subprocess.PIPE,
                            stdout=subprocess.PIPE,
                            shell=True,
                            executable='/bin/bash')
    proc.stdin.write(str.encode("pip install --upgrade %s\n" % (" ".join(self._loaded_packages),)))
    output, error = proc.communicate()
    print(output)
    print(error)
</code></pre>
