Improve virtualenv detection and package install under virtualenv