0

I'm on macOS Catalina [10.15]. Here is what I get when try to deactivate:

(django-learning) ~/git/stats-k8s/k8s-monitor (master) $ deactivate
DeprecationWarning: 'source deactivate' is deprecated. Use 'conda deactivate'.
(django-learning) ~/git/stats-k8s/k8s-monitor (master) $
(django-learning) ~/git/stats-k8s/k8s-monitor (master) $
(django-learning) ~/git/stats-k8s/k8s-monitor (master) $
(django-learning) ~/git/stats-k8s/k8s-monitor (master) $ conda deactivate

CommandNotFoundError: Your shell has not been properly configured to use 'conda deactivate'.
To initialize your shell, run
...    
IMPORTANT: You may need to close and restart your shell after running 'conda init'.
(django-learning) ~/git/stats-k8s/k8s-monitor (master) $

I already looked at question: How to leave/exit/deactivate a Python virtualenv but did not help.

Robert Ranjan
  • 1,538
  • 3
  • 19
  • 17
  • This looks like you're using `conda`, not standard `virtualenv`. – Charles Duffy Oct 13 '19 at 19:09
  • Did you activate this environment in the first place using conda or virtualenv? These are not the same thing. – gilch Oct 13 '19 at 19:15
  • Just found that the issue was with one shell[which I exited already]. Possibly, that was because I was trying to activate and deactivate my virtualenv using `direnv`. – Robert Ranjan Oct 13 '19 at 19:25

1 Answers1

4

I suspect that conda is is interfering with virtualenv on your setup. Did you install conda in the virtualenv?

Note that you can also safely close your terminal window and open a new one without using deactivate.

You might also try activating a different virtual environment. You can do this without deactivating first. Then you may be able to deactivate from the other environment.

gilch
  • 10,813
  • 1
  • 23
  • 28
  • 1
    At least for upstream virtualenv on systems with POSIX-y shells (can't speak to conda, which the OP's output implies they're using), `deactivate` is a shell function that `activate` defines; it's not a separate script. – Charles Duffy Oct 13 '19 at 19:08
  • It is on Windows, interesting. – gilch Oct 13 '19 at 19:10
  • Just as @CharlesDuffy mentioned, I can find a deactivate script on the /bin folder. – Robert Ranjan Oct 13 '19 at 19:11
  • @gilch, that makes sense, since in Windows, batch files are executed in-process (which you have to use `source` or an equivalent to get in the UNIX world). – Charles Duffy Oct 13 '19 at 19:12