If you are working on a custom PS1 (as I when found out this issue), I recommend you to disable prompt change, use export VIRTUAL_ENV_DISABLE_PROMPT=1
(see virtualenv docs), and make your own virtualenv prompt in order to add to your PS1.
See this snippet that I’ve used:
function virtualenv_info(){
# Get Virtual Env
if [[ -n "$VIRTUAL_ENV" ]]; then
# Strip out the path and just leave the env name
venv="${VIRTUAL_ENV##*/}"
else
# In case you don't have one activated
venv=''
fi
[[ -n "$venv" ]] && echo "(venv:$venv) "
}
# disable the default virtualenv prompt change
export VIRTUAL_ENV_DISABLE_PROMPT=1
VENV="\$(virtualenv_info)";
# the '...' are for irrelevant info here.
export PS1="... ${VENV} ..."