-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Activate Environments in Terminal Using Environment Variables
Python extension now activates the selected environment in the terminal without running any activation commands (#11039) using environment variables.
Traditionally, when working with Python environments in the terminal, you'd see indicators showing which Python environment is currently active. For example:
However, due to a technical limitation, you may now notice that this indicator is not modified, i.e it is either absent or that you continue to see an existing indicator like (base)
. Nonetheless, please be assured that the environment has still been 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 if both of the following is true:
- Automatic shell integration is turned off:
"terminal.integrated.shellIntegration.enabled": false
or not working. - Your shell init script (
~/.bashrc
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
For more information on environment variables as they relate to workspace environments and terminal activation, please see our docs on environment variable definitions file.
In other cases feel free to let us know via Python: Report Issue
command and we can help exploring workarounds for you.