Fix UnboundLocalError in creating venv function.