I setup a virtual env called (tut)
using virtualenvwrapper. When I open /Dev/
dir or any of its child dirs in VS code, the terminal adds the env name without brackets to my terminal:
tutusername@usernames-Mac Dev %
However, deactivate
command gives permission denied
so I thought it was maybe just a UI bug
which pip
and which python
point to /Users/username/.virtualenvs/tut/bin/pip
and /tut/bin/python
respectively, instead of my global installs of python/pip, which indicates its ‘stuck’ in the venv. I can also enter the (tut)
env itself, or other envs.
$ workon tut
(tut)tutusername@usernames-Mac Dev %
$ workon env1
(env1)tutusername@usernames-Mac Dev %
What’s worse is that if I open for example Documents/ folder, my terminal looks normal
username@usernames-Mac Documents %
I can cd
from here into the ‘bugged’ directory, so the issue seems to be with VS code ‘open folder’ into /Dev/
and its contents
$ cd Documents/Dev/
username@usernames-Mac Dev %
This issue first happened when I used a terminal macro, while (tut)
venv was activated. Which I wrote in ~/.zshrc
alias ch="code . -r"
Aside from this alias, my ~/.zprofile
has a few lines related to virtualenvwrapper for setup
export WORKON_HOME=~/.virtualenvs
mkdir -p $WORKON_HOME
source /opt/homebrew/bin/virtualenvwrapper.sh
Here’s what I’ve tried so far:
-
delete /tut/ folder
which python
&which pip
now points to global installations
-
"python.terminal.activateEnvironment": false
- no effect
To summarize, my issue is that I cannot open /Dev/ folder in VS code without getting ‘stuck’ in tut
venv. Even now after it doesnt exist.
Why is this happening? How can if be fixed?
itskillian is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.