ohmyzsh: virtualenvwrapper plugin: deactivate returns error

I’ve enabled the virtualenvwrapper plugin and added a .venv file to my project folder. When I cd to it my venv is activated successfully and when I cd out of it it is deactivated successfully. So far so good. However when I manually run deactivate while inside the directory I get the following:

deactivate:12: command not found: virtualenv_deactivate

Issuing which deactivate (before getting above error) returns the following:

deactivate () {
  typeset env_postdeactivate_hook
  typeset old_env
  virtualenvwrapper_run_hook "pre_deactivate"
  env_postdeactivate_hook="$VIRTUAL_ENV/$VIRTUALENVWRAPPER_ENV_BIN_DIR/postdeactivate"
  old_env=$(basename "$VIRTUAL_ENV")
  virtualenv_deactivate $1
  virtualenvwrapper_run_hook "post_deactivate" "$old_env"
  if [ ! "$1" = "nondestructive" ]
  then
    unset -f virtualenv_deactivate > /dev/null 2>&1
    unset -f deactivate > /dev/null 2>&1
  fi
}

Some notes:

  • I am not sourcing virtualenvwrapper.sh in my .zshrc (as it sourced by the plugin)
  • I have installed virtualenvwrapper==4.1.1 through pip.
  • My Python (2.7.5) was installed with homebrew

About this issue

  • Original URL
  • State: closed
  • Created 11 years ago
  • Comments: 22 (12 by maintainers)

Commits related to this issue

Most upvoted comments

I had a similar problem and fixed by changing the order of commands im my .zshrc. I put the lines that export virtualenv settings before sourcing .oh-my-zsh script.

+1