-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Activate Environments in Terminal Using Environment Variables
Python extension now activates selected environment in terminal without sending any activation commands (#11039). Traditionally, terminal prompts are generally used to indicate whether a Python env is currently activated in terminal:
However now, in some cases, the indicator might not be present at all. Nonetheless, please be assured that the environment is still activated.
Pro tips:
-
You can hover over the terminal tab to see which environment is currently activated in terminal:
-
Click "Show environment contributions" if you're interested in which specific environment variables were applied to activate this terminal:
Such implicit activation will not work in the following case:
- Fish is selected as the shell or shell integration is turned off:
"terminal.integrated.shellIntegration.enabled": false
- And your shell init script (
.bashrc
,profile.ps1
etc.) activates another environment (saymyshellenv
) for your shell. For eg. this can happen if"base"
conda environment is activated by default: #20885.
In this case myshellenv
will override the selected environment and terminal is activated using myshellenv
instead. This can be solved for conda base case by running the following command and restarting your shell:
conda config --set auto_activate_base False
In other cases feel free to let us know via Python: Report Issue
command and we can help exploring workarounds for you.
Please upvote if you run into any of these:
- Error when zsh shell is opened #188875; this can be safely ignored.
- Env set in my fish config prevails over selected environment #184009; workaround stated above in limitations section could help.