Python virtualenvwrapper: "workon" hangs endlessly
The name more or less says it all. An attempt workon $SOME_VIRTUALENV
is made to repeat the command, then hangs indefinitely at high CPU (~ 70%) until there is kill -9
' d. On OS X Mavericks.
I've searched around and most of the similar problems seem to come from people using zsh (which I don't know) and also getting crashes when filling in virtual name names (which I don't have), so I'm somewhat at a loss. Not much I know, but I'm not really a bash expert and even some suggestions on how to get some real diagnostic information would be appreciated.
$ echo $OSTYPE
darwin13.1.0
$ echo $SHELL
usr/local/bin/bash
$ echo $BASH_VERSION
4.0.0(1)-release
$ which python
/usr/local/bin/python
$ python --version
Python 2.7.8
$ pip show virtualenv
---
Name: virtualenv
Version: 1.11.6
Location: /usr/local/lib/python2.7/site-packages
Requires:
$ pip show virtualenvwrapper
---
Name: virtualenvwrapper
Version: 4.3.1
Location: /usr/local/lib/python2.7/site-packages
Requires: virtualenv, virtualenv-clone, stevedore
.bashrc (more or less copied somewhere):
# Locate virtualenvwrapper binary
if [ -f /usr/local/bin/virtualenvwrapper.sh ]; then
export VENVWRAP=/usr/local/bin/virtualenvwrapper.sh
fi
if [ ! -z $VENVWRAP ]; then
# virtualenvwrapper -------------------------------------------
# make sure env directory exists; else create it
[ -d $HOME/sites/env ] || mkdir -p $HOME/sites/env
export WORKON_HOME=$HOME/sites/env
source $VENVWRAP
# virtualenv --------------------------------------------------
export VIRTUALENV_USE_DISTRIBUTE=true
# pip ---------------------------------------------------------
export PIP_VIRTUALENV_BASE=$WORKON_HOME
export PIP_REQUIRE_VIRTUALENV=false
export PIP_RESPECT_VIRTUALENV=true
export PIP_DOWNLOAD_CACHE=$HOME/.pip/cache
fi
source to share
For posterity, for poor souls looking for this later:
I eventually found the culprit for this problem, if not the cause. The custom tab execution created by virtualenvwrapper was causing a serious problem; if I try to execute the tab workon
, the next command entered will cause the above problem. This happened even if I pressed Ctrl-C'd from a command filled with a tab and entered a new one.
So, I just stopped using tabs on workon
and removed the contents of the function virtualenvwrapper_setup_tab_completion
(replacing without anything true
) in virtualenvwrapper.sh
so I couldn't accidentally do it.
I could perhaps dive deeper and understand why taboo completion would cause a problem, but it just isn't worth the effort right now. There were other examples of people with problems terminating the virtualenvwrapper tab that I found, but in those cases, the terminal crashed immediately when they tried to use it, which is not the case here.
source to share
If you're not sure what you are putting into your bashrc, then don't put it there. Maybe the paths are doing strange things and this is the reason everything gets stuck.
Please try to comment on the thing written there.
Follow these steps: http://virtualenvwrapper.readthedocs.org/en/latest/install.html or run: find virtualenvwrapper.sh
The path you get is what you need. edit the .bashrc file and add: source / path -of-what-you-got-earlier / virtualenvwrapper.sh
After saving save and close and execute: source .bashrc
(you might need to tweak WORKON_HOME anyway. I don't remember) Try to see if something has changed.
If not, try creating a new virtualenv
source to share