Set environment variables after virtualenv

This ensures that the virtualenv variables are set before defining the ones we depend on.

Hopefully this will be the last fix. :)