You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Reconsider changing default value of "python.terminal.activateEnvInCurrentTerminal" to true #19563
Python version (and distribution if applicable, e.g. Anaconda): Python 3.8.8, conda 4.13.0
python.analysis.indexing: null
python.analysis.typeCheckingMode: off
Repro Steps
Have Anaconda, and create an anaconda venv that is not base (in addition to base
Add the following to the workspace settings (get path from activating the env, then typingwhich python)
{
"python.defaultInterpreterPath": "/Users/[...]/anaconda3/envs/[your_env]/bin/python",
}
Restart VSCode to activate Anaconda
Open a terminal window using View: Toggle Terminal, note how conda activate yourenv is run
Close and reopen VSCode.
Expected behavior
When I restart VsCode, the previous environment is restored (or if not possible, the environment that is associated with the defaultInterpreterPath is restored)
Actual behavior
When I restart VSCode, the enviroment is not restored, and instead the base envirnoment is active.
Are you saying the environment activated in terminal is not the one you've selected (which is yourenv)? Try setting "python.terminal.activateEnvInCurrentTerminal": true in settings.json. If that doesn't work please provide screenshots to clarify what is expected, and provide the logs as mentioned in the issue template.
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
Yep I think it was because some users may not like us altering their current shell automatically, however I think that can be revisited, converting this into a discussion so we can reconsider it.
changed the title [-]Conda Env not Restored when VSCode is Restarted[/-][+]Reconsider changing default value of "python.terminal.activateEnvInCurrentTerminal" to `true`[/+]on Aug 2, 2022
Activity
heejaechang commentedon Jul 25, 2022
it looks like python core ext bug.
karrtikr commentedon Jul 29, 2022
Are you saying the environment activated in terminal is not the one you've selected (which is
yourenv)? Try setting"python.terminal.activateEnvInCurrentTerminal": trueinsettings.json. If that doesn't work please provide screenshots to clarify what is expected, and provide the logs as mentioned in the issue template.Output for
Pythonin theOutputpanel (View→Output, change the drop-down the upper-right of theOutputpanel toPython)Gamrix commentedon Aug 2, 2022
Ok, adding that setting fixed the issue. Is there a reason why that setting is not the default?
Also, I don't see it called out anywhere on https://code.visualstudio.com/docs/python/environments
karrtikr commentedon Aug 2, 2022
Yep I think it was because some users may not like us altering their current shell automatically, however I think that can be revisited, converting this into a discussion so we can reconsider it.
It's in https://code.visualstudio.com/docs/python/settings-reference, perhaps we should also mention it in the environment docs if it's off by default. We'll create an issue in the docs https://github.com/microsoft/vscode-docs/issues if need be after the discussion.
[-]Conda Env not Restored when VSCode is Restarted[/-][+]Reconsider changing default value of "python.terminal.activateEnvInCurrentTerminal" to `true`[/+]