title: Python reload pip doesn't work
body: <p>I am currently trying to upgrade pip and then install paramiko inside a python script because the script itself makes use of paramiko. Below is a simple case of what I am trying to accomplish</p>
  
  <pre><code>import pip
  
  try:
          import paramiko
  except ImportError:
          pip.main(["install", "--upgrade", "pip"])
          reload(pip)
          pip.main(["install", "--user", "paramiko"])
          import paramiko
  
  ssh = paramiko.SSHClient()
  </code></pre>
  
  <p>I am running this script in an Ubuntu 16.04 VM with python 2.7 which doesn't have paramiko and pip version 8.1.1. For the output of the pip upgrade after running the script, I get: </p>
  
  <blockquote>
    <p>Collecting pip   Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)
        100% |████████████████████████████████| 1.3MB 712kB/s Installing collected packages: pip Successfully installed pip-8.1.1 You are using
    pip version 8.1.1, however version 9.0.1 is available. You should
    consider upgrading via the 'pip install --upgrade pip' command.</p>
  </blockquote>
  
  <p>After that, it tries to install paramiko as expected, but it fails because it basically can't install the Cryptography dependency that paramiko uses. However, if it was using the upgraded pip, this would not be a problem. I have reverted the VM back to a previous snapshot to manually install paramiko by doing</p>
  
  <pre><code>pip install --upgrade pip
  pip install --user paramiko
  </code></pre>
  
  <p>in the shell and it works, but I need to be able to perform this in a script. </p>
  
  <p>Note, I also reverted the VM to a previous snapshot and tried installing paramiko with the above command in the shell, but without performing the pip upgrade first, and as expected I get the same error as what the script gives when trying to install paramiko. 
  Now I have done a bit of testing by trying to having this in the script:</p>
  
  <pre><code>pip.main(["install", "--upgrade", "pip"])
  reload(pip)
  pip.main(["install", "--upgrade", "pip"])
  reload(pip)
  </code></pre>
  
  <p>and as for the output I get this:</p>
  
  <blockquote>
    <p>Collecting pip<br>
    Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)</p>
  
  <pre><code>100% |████████████████████████████████| 1.3MB 712kB/s Installing collected packages: pip Successfully installed pip-8.1.1 You are using pip version 8.1.1, however version 9.0.1 is available. 
  </code></pre>
    
    <p>You should consider upgrading via the 'pip install --upgrade pip' command.</p>
    
    <p>Collecting pip<br>
    Using cached pip-9.0.1-py2.py3-none-any.whl</p>
    
    <p>Installing collected packages: pip Successfully installed pip-8.1.1</p>
    
    <p>You are using pip version 8.1.1, however version 9.0.1 is available.</p>
    
    <p>You should consider upgrading via the 'pip install --upgrade pip' command.</p>
  </blockquote>
  
  <p>Notice how it says using cached pip-9.0.1 at the second pip upgrade. Does this mean after the reload, the script is using pip 9.0.1? If so then why is the paramiko install not using the upgraded pip? How can I get the paramiko to use the upgraded pip?</p>