title: Activating virtualenv via chef recipe and install python library
body: <p>I have a python package that needs to be installed in virtualenv. This is a virtual server and it is provisioned by chef recipes displayed below. I tried multiple variations to activate the virtualenv but no dice. Any pointers appreciated.</p>
  
  <pre><code>python_virtualenv "/home/vagrant/myenv" do
    interpreter "python2.7"
    owner "vagrant"
    group "vagrant"
    action :create
  end
  
  
  
  directory "/usr/local/mysource" do
    owner "vagrant"
    group "vagrant"
    mode 0755
    action :create
  end
  
  
  
  git "/usr/local/mysource/django" do
    repository "https://github.com/django/django"
    revision "master"
    action :sync
  end
  
  
  script "install_script" do
    interpreter "bash"
    user "vagrant"
    cwd "/usr/local/mysource/django"
    code &lt;&lt;-EOH
    activate_env=os.path.expanduser("/home/vagrant/myenv/bin/activate_this.py")
    execfile(activate_env, dict(__file__=activate_env))
    python setup.py install
    EOH
  end
  </code></pre>