Re:There's no magic: virtualenv edition
by skyraider on Tuesday February 19, 2013 @12:03AM
(#5242744)
Using Fabric's
with prefix('source venv/bin/activate'):
.. is not annoying in the slightest (to me).
Re:There's no magic: virtualenv edition
by kenneth_reitz on Tuesday February 19, 2013 @12:51AM
(#5242865)
Yeah, just put the venv's bin dir at the head of the script's PATH.
Depends on what you are running and from where. The usual virtualenv activate (although I recommend virtualenvwrapper's workon) works fine for a human interacting with a terminal.
But it is annoying for bash scripts, extremely annoying for Fabric scripts where each command is run in a separate SSH session, and sometimes completely impossible when a server needs to spawn a python subprocess. Used this exact method to solve issues with nginx+uwsgi web server deployments a few weeks ago.
Using the full path to the virtualenv's python works in any context, even when you can't set environment variables or run two commands.