Using "workon" does not list available environments

1,961 views
Skip to first unread message

Micky Hulse

unread,
Jul 12, 2013, 9:26:26 PM7/12/13
to virtuale...@googlegroups.com
Hello,

My setup:

OS X, 10.8.4
Using Homebrew package manager

Outline of installation steps:

$ brew install python
$ pip install virtualenv
$ pip install virtualenvwrapper

Contents of my .bashrc file:

[snip]

# Python virtual environments:
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages'
export PIP_VIRTUALENV_BASE=$WORKON_HOME
export PIP_RESPECT_VIRTUALENV=true
if [[ -r /usr/local/bin/virtualenvwrapper.sh ]]; then
    source /usr/local/bin/virtualenvwrapper.sh
else
    echo "WARNING: Can't find virtualenvwrapper.sh"
fi

[/snip]

Ran:

$ source ~/.bashrc
$ mkvirtualenv foo

The above makes a virtualenv called "foo".

I can see my virtualenvs in ~/.virtualenvs

I can activate/deactivate said virtualenvs.

When I run:

$ workon

I don't get a list.

I can't figure out why workon does not return a list  of available environments ... The only oddity on my system is that my home folder's drive name has a space in it:

$ echo $HOME
/Volumes/DRIVE 1/myuserfolder

Could the space in the drive name be the problem? Am I overlooking something obvious here?

Any help would be greatly appreciated. ;)

Thanks!
M

Doug Hellmann

unread,
Jul 13, 2013, 11:12:54 AM7/13/13
to virtuale...@googlegroups.com, virtuale...@googlegroups.com
Does the lsvirtualenv command produce any results?

Doug
--
You received this message because you are subscribed to the Google Groups "virtualenvwrapper" group.
To unsubscribe from this group and stop receiving emails from it, send an email to virtualenvwrap...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Micky Hulse

unread,
Jul 15, 2013, 1:36:38 PM7/15/13
to virtuale...@googlegroups.com
Hi Doug! Thanks so much for the help, I really appreciate it.

Sorry for my late reply ... The weekend hit and I ended up away from
the computer.

On Sat, Jul 13, 2013 at 8:12 AM, Doug Hellmann <doug.h...@gmail.com> wrote:
> Does the lsvirtualenv command produce any results?

Good question! Here are the results:

$ which virtualenv
/usr/local/bin/virtualenv
$ lsvirtualenv
-bash: lsvirtualenv: command not found

That seems odd as I have 3 virtualenvs in ~/.virtualenvs/. I must have
setup something wrong? Not sure where to look to fix it.

Thanks again for the help!

Cheers,
Micky

Doug Hellmann

unread,
Jul 15, 2013, 3:56:38 PM7/15/13
to virtuale...@googlegroups.com
It sounds like you don't have virtualenvwrapper configured properly in your shell environment.

Which shell are you using and what do you have in your startup file?

Micky Hulse

unread,
Jul 15, 2013, 5:39:01 PM7/15/13
to virtuale...@googlegroups.com
Hi Doug! Thank you for your help/reply, I really appreciate it!

On Mon, Jul 15, 2013 at 12:56 PM, Doug Hellmann <doug.h...@gmail.com> wrote:
> It sounds like you don't have virtualenvwrapper configured properly in your shell environment.

Ah, I had a feeling I had setup something wrong.

> Which shell are you using

I'm using bash shell:

$ echo $SHELL
/bin/bash

> and what do you have in your startup file?

This is my .bash_profile and .bashrc files:

<https://gist.github.com/mhulse/6003668>

Not sure if this will help, but my /private/etc/paths contains:

/usr/local/share/npm/bin
/usr/local/bin
/usr/local/sbin
/usr/bin
/bin
/usr/sbin
/sbin

Again, I'm using HomeBrew on OS X Mountain Lion.

I used brew to install Python.

Pip lives here:

$ which pip
/usr/local/bin/pip

... and here's what I've installed using pip:

$ pip freeze
Django==1.3.1
distribute==0.6.45
django-debug-toolbar==0.9.4
git-remote-helpers==0.1.0
stevedore==0.9.1
virtualenv==1.9.1
virtualenv-clone==0.2.4
virtualenvwrapper==4.0
wsgiref==0.1.2

Again, thanks so much for your help, I greatly appreciate you taking
the time to hold my hand on this one. :)

Let me know if there's more information I can provide.

Have a nice day!

Cheers,
Micky

Doug Hellmann

unread,
Jul 15, 2013, 7:52:45 PM7/15/13
to virtuale...@googlegroups.com

On Jul 15, 2013, at 5:39 PM, Micky Hulse <rgm...@gmail.com> wrote:

> Hi Doug! Thank you for your help/reply, I really appreciate it!
>
> On Mon, Jul 15, 2013 at 12:56 PM, Doug Hellmann <doug.h...@gmail.com> wrote:
>> It sounds like you don't have virtualenvwrapper configured properly in your shell environment.
>
> Ah, I had a feeling I had setup something wrong.
>
>> Which shell are you using
>
> I'm using bash shell:
>
> $ echo $SHELL
> /bin/bash
>
>> and what do you have in your startup file?
>
> This is my .bash_profile and .bashrc files:
>
> <https://gist.github.com/mhulse/6003668>

That looks OK. It doesn't explain why lsvirtualenv is not defined.

Do you see any error messages if you run "source /usr/local/bin/virtualenvwrapper.sh" from the command line?

I can never remember if the .bash_profile or .bashrc is loaded for a login shell (and vice versa), so it's possible you've got the source line in the wrong startup file.

Doug

Micky Hulse

unread,
Jul 15, 2013, 8:45:38 PM7/15/13
to virtuale...@googlegroups.com
On Mon, Jul 15, 2013 at 4:52 PM, Doug Hellmann <doug.h...@gmail.com> wrote:
> That looks OK. It doesn't explain why lsvirtualenv is not defined.

Hmm, strange. I wonder what I've done to my system? Honestly,
everything appears to work, so not being able to list my virtual
environments is mostly an oddity or minor annoyance to me ... I'd like
to get it fixed, but it's not a huge setback if I can't get it solved.

> Do you see any error messages if you run "source /usr/local/bin/virtualenvwrapper.sh" from the command line?

Unfortunately not.

$ source /usr/local/bin/virtualenvwrapper.sh
$

> I can never remember if the .bash_profile or .bashrc is loaded for a login shell (and vice versa), so it's possible you've got the source line in the wrong startup file.

Interesting. I normally use .bash_profile ... my co-worker is using
.bashrc and it's working for him (with similar homebrew/pip setup) so
I figured I'd move everything into .bashrc.

Do you think the space in my drive name could be a problem?

When I installed OS X, I moved my user's home folder to a secondary
drive. This secondary drive has a space in it. I've run into problems
before with the space (I don't remember specifics) but I was wondering
if maybe there could be some sort of path/escaping problem.

Thanks again for taking the time to help me out. I owe you one. :)

--
Micky Hulse
Web Content Editor
The Register-Guard
3500 Chad Drive
Eugene, OR 97408
Phone: (541) 338-2621
Fax: (541) 683-7631
Web: <http://www.registerguard.com>

Doug Hellmann

unread,
Jul 16, 2013, 6:30:21 PM7/16/13
to virtuale...@googlegroups.com

On Jul 15, 2013, at 8:45 PM, Micky Hulse <rgm...@gmail.com> wrote:

> On Mon, Jul 15, 2013 at 4:52 PM, Doug Hellmann <doug.h...@gmail.com> wrote:
>> That looks OK. It doesn't explain why lsvirtualenv is not defined.
>
> Hmm, strange. I wonder what I've done to my system? Honestly,
> everything appears to work, so not being able to list my virtual
> environments is mostly an oddity or minor annoyance to me ... I'd like
> to get it fixed, but it's not a huge setback if I can't get it solved.
>
>> Do you see any error messages if you run "source /usr/local/bin/virtualenvwrapper.sh" from the command line?
>
> Unfortunately not.
>
> $ source /usr/local/bin/virtualenvwrapper.sh
> $
>
>> I can never remember if the .bash_profile or .bashrc is loaded for a login shell (and vice versa), so it's possible you've got the source line in the wrong startup file.
>
> Interesting. I normally use .bash_profile ... my co-worker is using
> .bashrc and it's working for him (with similar homebrew/pip setup) so
> I figured I'd move everything into .bashrc.
>
> Do you think the space in my drive name could be a problem?

That could be it. Try setting WORKON_HOME to something like /tmp/mydir and see if that helps at all. If it does, I'll double-check the tests (I really thought I had one for this case, but maybe not).

Doug

>
> When I installed OS X, I moved my user's home folder to a secondary
> drive. This secondary drive has a space in it. I've run into problems
> before with the space (I don't remember specifics) but I was wondering
> if maybe there could be some sort of path/escaping problem.
>
> Thanks again for taking the time to help me out. I owe you one. :)
>
> --
> Micky Hulse
> Web Content Editor
> The Register-Guard
> 3500 Chad Drive
> Eugene, OR 97408
> Phone: (541) 338-2621
> Fax: (541) 683-7631
> Web: <http://www.registerguard.com>
>

Micky Hulse

unread,
Jul 16, 2013, 6:40:11 PM7/16/13
to virtuale...@googlegroups.com
On Tue, Jul 16, 2013 at 3:30 PM, Doug Hellmann <doug.h...@gmail.com> wrote:
> /tmp/mydir

Omg, that helped!

I changed this:

export WORKON_HOME=$HOME/.virtualenvs

... to this:

export WORKON_HOME=/tmp/foo/.virtualenvs

And now:

$ mkvirtualenv billy
$ lsvirtualenv
billy

Woot!

When I swtich back to the $HOME version, lsvirtualenv returns nothing.

Wow, now I'm really regretting ever having put a space in my drive's name.

Not sure if it would be helpful to you, but is there any testing I can
do to help you patch anything (that is, if you feel like this deserves
a patch ... I doubt there are many people out there with spaces in
their HDD names).

Thanks again Doug! You da man! :)

Cheers,
M

Micky Hulse

unread,
Jul 16, 2013, 6:48:15 PM7/16/13
to virtuale...@googlegroups.com
Oh, not sure if this is any importance, but I also moved everything
into .bash_profile. It seems to work in there just fine (as opposed to
.bashrc).

Doug Hellmann

unread,
Jul 16, 2013, 7:00:44 PM7/16/13
to virtuale...@googlegroups.com
If you would open a bug on bitbucket, that would help. If you don't, I'll try to get to it this weekend. The fix shouldn't be too hard, I'm probably just not quoting something in one of the functions.

Famous-last-words-ly,
Doug

Micky Hulse

unread,
Jul 16, 2013, 7:06:38 PM7/16/13
to virtuale...@googlegroups.com
On Tue, Jul 16, 2013 at 4:00 PM, Doug Hellmann <doug.h...@gmail.com> wrote:
> If you would open a bug on bitbucket, that would help. If you don't, I'll try to get to it this weekend. The fix shouldn't be too hard, I'm probably just not quoting something in one of the functions.
> Famous-last-words-ly,

Lol! Ah yes, the famous last words. :)

I'll open a ticket here shortly. Thanks a billion for all of your
help, I greatly appreciate it!

Cheers,
M
Reply all
Reply to author
Forward
0 new messages