Issue #46 resolved

document shell dependencies

Eddie Welker
created an issue

In line 57,


if an alias for the current python is present, which will return both the alias and the standard path to the binary like so:

alias python='python2.5' /usr/local/bin/python2.5

resulting in to fail on a "No such file or directory" whenever it tries to use the binary that 'which' found.

Comments (12)

  1. Doug Hellmann repo owner

    I can't reproduce that.

    Do you have some global options set that change the behavior of which? Are you using the shell built-in or the external program (what does "which which" report)?

  2. Doug Hellmann repo owner

    I'm not sure about the best solution for this in the main code. It isn't portable to assume a path to which. Assuming "which" is an alias and parsing the output isn't portable either, because it could be aliased to anything. Using unalias to remove a potential alias would break your shell.

    You could work around the problem by setting VIRTUALENVWRAPPER_PYTHON before sourcing Have you tried that?

  3. Eddie Welker reporter

    I agree with your conclusion... I would leave your code alone here. At best, this seems like it should be added as a footnote in the documentation, no more. I do appreciate your taking a look, I wouldn't have guessed that which was aliased.

    I had already got it working by pre-setting the wrapper variable, so that's not an issue, but thanks.

  4. Clayton Parker

    I had the same issue, but I had aliased which to "which -a", thus having multiple python executables in my path caused a similar issue.

    Instead of hoping that people won't alias which, you could use a backslash to escape any aliases:

    VIRTUALENVWRAPPER_PYTHON="$(\which python)"

    I also had grep aliased to ack :) So this was causing me issues as well (I've been thinking about removing this alias anyway). Once I fixed that up then I ran into one more issue with egrep, in this line:

    if echo "$WORKON_HOME" | egrep -e "([$]|)" >/dev/null

    I had to escape the dollar sign like so (assuming because I'm using ZSH with extended glob)

    if echo "$WORKON_HOME" | egrep -e "([\$]|)" >/dev/null

    After that, the script seems to work fine

  5. Clayton Parker

    I actually ran into other issues once I fixed the above ones. I'll have to re-visit it later to see what the issues were (this was with v2.2). I suspect it was because I am using zsh and not bash.

  6. Log in to comment