Why I am suddenly seeing `Usage: source deactivate` whenever I run virtualenvwrapper commands?
Asked Answered
W

3

19

I never used to see this message before when using virtualenvwrapper, but now I'm suddenly seeing this message whenever I run, say, mkvirtualenv <environment> or workon <environment>:

Usage: source deactivate

removes the 'bin' directory of the environment activated with 'source
activate' from PATH. 

I haven't modified virtualenvwrapper at all, and a quick google search only yields this GitHub issue -- I did install IPython/Anaconda a while back, but I'm not sure how it might be interfering with virtualenvwrapper. In any case, I tried updating both (conda update conda; conda update ipython), as well as updating virtualenvwrapper itself to v4.1.1, but I'm still seeing this error.

I'm running OS X 10.8.4.

Witmer answered 8/11, 2013 at 21:45 Comment(3)
I guess it's calling what it thinks is its own deactivate, but it ends up calling conda's deactivate instead.Denny
Same thing happened to my virtualenvwrapper after installing iPython/Anaconda. As per the Anaconda docs Linux/OSX Uninstall, a rm -fr ~/anaconda fixed it. I'm on OS X 10.9.2.Hadron
I really wish everyone would stop trying to wrap virtualenv. It's such a pain when it breaks.Pretoria
Y
17

workon, which is defined in /usr/local/bin/virtualenvwrapper.sh, calls deactivate. A script of the same name is present in Anaconda's bin, so it gets called by workon.

The best solution I've found so far is to rename activate and deactivate in Anaconda's bin. If there's a better solution, please comment and I'll update this answer.

Yon answered 5/6, 2014 at 23:3 Comment(8)
Please explain. In "N"? This looks like it has been the cause of many days of issues so I am very grateful for all the help you can give.Kerri
"in N" was where I was really confused.Kerri
Looks like my comment was mangled or cut off. I posted it literally a year ago, but I'll do my best to remember what I meant to write.Yon
I went and renamed deactivate - thank you for the idea! It brought me past that and onto another environment issue ;) Such is the developing in Python!Kerri
Would be great if you could mark my answer as correct. :)Yon
The answer is missing a check mark - I think you upvoted it but didn't mark it as correct?Yon
Sorry - I am benefiting from your answer but I didnt author the question . .Kerri
Renaming file isn't the best solution ! See this answer : stackoverflow.com/a/42014049Tweezers
T
1

This happened to me after installing Anaconda from https://www.continuum.io/downloads. If you don't need the program and it will be uninstalled, remove the following from your ~/.bash_profile:

added by Anaconda2 4.2.0 installer
export PATH="//anaconda/bin:$PATH"
Topography answered 7/11, 2016 at 16:14 Comment(0)
T
0

Anaconda already knows where activate and the different environments are so virtualenvwrapper isn't needed.

All virtualenvwrapper seems to provide on Mac is the workon shortcut to source activate, you can use an alias in your bash.rc file and uninstall virtualenvwrapper.

Just add the alias line below where you add ~/anaconda/bin to your path like the example below.

# added by Anaconda3 4.3.1 installer
export PATH="$HOME/anaconda/bin:$PATH"

# Add workon alias here!
alias workon='source activate'

Now when I run 'workon Django', it runs my Anaconda Django virtual env without reminding me that 'source deactivate' is the way to exit.

If you didn't catch that, to exit the virtual env just run 'source deactivate'

Telegraphy answered 19/8, 2017 at 3:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.