title: How to use a virtualenv to install packages but still use the system tensorflow install
body: <p>On my local machine I have it set up so that I install these dependencies in a virtual environment while doing ML testing</p>
  
  <pre><code>tensorflow
  keras
  h5py
  requests
  pillow
  tensorflow-hub
  </code></pre>
  
  <p>I have scripts that will go through, make a venv, install the requirements, and perform the training. It would be nice if I could use these scripts anywhere, including on the Google Deep Learning Platform VMs, but when I try to install tensorflow in the venv it no longer uses the GPU, so I'm assuming it's no longer using the system install of tensorflow.</p>
  
  <p>I also tried the <code>--system-site-packages</code> flag and that said that tensorflow was already installed but then it stopped using the GPU.</p>
  
  <p>Let's say I do the following</p>
  
  <pre><code>$ virtualenv --sysem-site-packages venv/
  $ source venv/bin/activate
  $ pip install -r requirements.txt
  Collecting tensorflow (from -r requirements.txt (line 1))
    Using cached https://files.pythonhosted.org/packages/1a/c4/8cb95df0bf06089014259b25997c3921a87aa08e2cd981417d91ca92f7e9/tensorflow-1.10.1-cp27-cp27mu-manylinux1_x86_64.whl
  Requirement already satisfied: keras in /usr/local/lib/python2.7/dist-packages (from -r requirements.txt (line 2)) (2.2.2)
  Requirement already satisfied: h5py in /usr/lib/python2.7/dist-packages (from -r requirements.txt (line 3)) (2.7.0)
  Requirement already satisfied: requests in /usr/lib/python2.7/dist-packages (from -r requirements.txt (line 4)) (2.12.4)
  Requirement already satisfied: pillow in /usr/lib/python2.7/dist-packages (from -r requirements.txt (line 5)) (4.0.0)
  Requirement already satisfied: tensorflow-hub in /home/john/.local/lib/python2.7/site-packages (from -r requirements.txt (line 6)) (0.1.1)
  Collecting numpy&lt;=1.14.5,&gt;=1.13.3 (from tensorflow-&gt;-r requirements.txt (line 1))
    Using cached https://files.pythonhosted.org/packages/6a/a9/c01a2d5f7b045f508c8cefef3b079fe8c413d05498ca0ae877cffa230564/numpy-1.14.5-cp27-cp27mu-manylinux1_x86_64.whl
  Requirement already satisfied: grpcio&gt;=1.8.6 in /usr/local/lib/python2.7/dist-packages (from tensorflow-&gt;-r requirements.txt (line 1)) (1.14.1)
  Requirement already satisfied: protobuf&gt;=3.6.0 in /home/john/.local/lib/python2.7/site-packages (from tensorflow-&gt;-r requirements.txt (line 1)) (3.6.1)
  Requirement already satisfied: termcolor&gt;=1.1.0 in /usr/local/lib/python2.7/dist-packages (from tensorflow-&gt;-r requirements.txt (line 1)) (1.1.0)
  Requirement already satisfied: backports.weakref&gt;=1.0rc1 in /usr/local/lib/python2.7/dist-packages (from tensorflow-&gt;-r requirements.txt (line 1)) (1.0.post1)
  Requirement already satisfied: absl-py&gt;=0.1.6 in /usr/local/lib/python2.7/dist-packages (from tensorflow-&gt;-r requirements.txt (line 1)) (0.3.0)
  Requirement already satisfied: wheel in ./venv/lib/python2.7/site-packages (from tensorflow-&gt;-r requirements.txt (line 1)) (0.31.1)
  Requirement already satisfied: tensorboard&lt;1.11.0,&gt;=1.10.0 in /usr/local/lib/python2.7/dist-packages (from tensorflow-&gt;-r requirements.txt (line 1)) (1.10.0)
  Requirement already satisfied: six&gt;=1.10.0 in /home/john/.local/lib/python2.7/site-packages (from tensorflow-&gt;-r requirements.txt (line 1)) (1.11.0)
  Requirement already satisfied: gast&gt;=0.2.0 in /usr/local/lib/python2.7/dist-packages (from tensorflow-&gt;-r requirements.txt (line 1)) (0.2.0)
  Requirement already satisfied: mock&gt;=2.0.0 in /usr/lib/python2.7/dist-packages (from tensorflow-&gt;-r requirements.txt (line 1)) (2.0.0)
  Requirement already satisfied: enum34&gt;=1.1.6 in /usr/lib/python2.7/dist-packages (from tensorflow-&gt;-r requirements.txt (line 1)) (1.1.6)
  Requirement already satisfied: astor&gt;=0.6.0 in /usr/local/lib/python2.7/dist-packages (from tensorflow-&gt;-r requirements.txt (line 1)) (0.7.1)
  Collecting setuptools&lt;=39.1.0 (from tensorflow-&gt;-r requirements.txt (line 1))
    Using cached https://files.pythonhosted.org/packages/8c/10/79282747f9169f21c053c562a0baa21815a8c7879be97abd930dbcf862e8/setuptools-39.1.0-py2.py3-none-any.whl
  Requirement already satisfied: pyyaml in /usr/lib/python2.7/dist-packages (from keras-&gt;-r requirements.txt (line 2)) (3.12)
  Requirement already satisfied: scipy&gt;=0.14 in /usr/lib/python2.7/dist-packages (from keras-&gt;-r requirements.txt (line 2)) (0.18.1)
  Requirement already satisfied: keras-applications==1.0.4 in /usr/local/lib/python2.7/dist-packages (from keras-&gt;-r requirements.txt (line 2)) (1.0.4)
  Requirement already satisfied: keras-preprocessing==1.0.2 in /usr/local/lib/python2.7/dist-packages (from keras-&gt;-r requirements.txt (line 2)) (1.0.2)
  Requirement already satisfied: futures&gt;=2.2.0 in /usr/local/lib/python2.7/dist-packages (from grpcio&gt;=1.8.6-&gt;tensorflow-&gt;-r requirements.txt (line 1)) (3.2.0)
  Requirement already satisfied: markdown&gt;=2.6.8 in /usr/lib/python2.7/dist-packages (from tensorboard&lt;1.11.0,&gt;=1.10.0-&gt;tensorflow-&gt;-r requirements.txt (line 1)) (2.6.8)
  Requirement already satisfied: werkzeug&gt;=0.11.10 in /usr/lib/python2.7/dist-packages (from tensorboard&lt;1.11.0,&gt;=1.10.0-&gt;tensorflow-&gt;-r requirements.txt (line 1)) (0.11.15)
  tensorflow-serving-api 1.10.0 has requirement protobuf==3.6.0, but you'll have protobuf 3.6.1 which is incompatible.
  Installing collected packages: numpy, setuptools, tensorflow
    Found existing installation: numpy 1.15.1
      Not uninstalling numpy at /home/john/.local/lib/python2.7/site-packages, outside environment /home/john/retrain/venv
      Can't uninstall 'numpy'. No files were found to uninstall.
    Found existing installation: setuptools 40.2.0
      Uninstalling setuptools-40.2.0:
        Successfully uninstalled setuptools-40.2.0
  Successfully installed numpy-1.14.5 setuptools-39.1.0 tensorflow-1.10.1
  </code></pre>
  
  <p>For all of the dependencies tensorflow it shows that as existing on the system so it doesn't install them, but it then goes and installed tensorflow anyways. Why is that?</p>