title: How can I make jenkins run "pip install"?
body: <p>I have a git repo and would like to get jenkins to clone it then run</p>
  
  <pre><code>virtualenv venv --distribute
  /bin/bash venv/source/activate
  pip install -r requirements.txt
  python tests.py
  </code></pre>
  
  <p>The console output from jenkins is:</p>
  
  <pre><code>+ virtualenv venv --distribute
  New python executable in venv/bin/python
  Installing distribute..........................done.
  Installing pip...............done.
  + /bin/bash venv/bin/activate
  + pip install -r requirements.txt
  Downloading/unpacking flask (from -r requirements.txt (line 1))
    Running setup.py egg_info for package flask
  
  SNIP
  
  creating /usr/local/lib/python2.7/dist-packages/flask
  
  error: could not create '/usr/local/lib/python2.7/dist-packages/flask': Permission denied
  
  ----------------------------------------
  Command /usr/bin/python -c "import setuptools;__file__='/var/lib/jenkins/workspace/infatics-website/build/flask/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-hkdBAi-record/install-record.txt failed with error code 1
  Storing complete log in /home/jenkins/.pip/pip.log
  Build step 'Execute shell' marked build as failure
  Finished: FAILURE
  </code></pre>
  
  <p>I've tried adding sudo before the command, but it's doesn't work either:</p>
  
  <pre><code>+ sudo pip install -r requirements.txt
  sudo: no tty present and no askpass program specified
  Sorry, try again.
  sudo: no tty present and no askpass program specified
  Sorry, try again.
  sudo: no tty present and no askpass program specified
  Sorry, try again.
  sudo: 3 incorrect password attempts
  Build step 'Execute shell' marked build as failure
  Finished: FAILURE
  </code></pre>
  
  <p>Any ideas how to get around this? Also when I run pip install -r requirement.txt in a terminal as the jenkins user it doesn't need sudo permission. Can I get jenkins (the process) to run as the jenkins user?</p>