If you followed a pre-2026 tutorial, you probably set python.terminal.activateEnvironment to true and expected every new terminal to open with your .venv already active. After the Python Environments extension rollout, that setting can look broken: the interpreter in the status bar is correct, but the terminal still starts with the system Python. The usual cause is not a broken environment — it is a precedence change. This guide shows which setting now controls activation, how to pick the right mode, and how to prove the terminal is using the interpreter you selected.
Table of Contents
- What terminal activation actually does
- Why two settings appear to fight over one terminal
- The precedence check, in order
- Choose an activation mode
- Verify the terminal is using the selected interpreter
- Clean up stale settings and startup scripts
- Conclusion
What terminal activation actually does
Activating an environment is just a shortcut for making python, pip, and installed console scripts resolve to one environment. The standard library's venv module explains that an activation script prepends the environment's bin directory (or Scripts on Windows) to PATH, so bare python calls hit the environment's interpreter instead of the global one. It also sets VIRTUAL_ENV to the environment path, though the documentation warns that VIRTUAL_ENV alone cannot prove an environment is in use, because activation is optional (Python venv documentation).
VS Code automates that step when it opens an integrated terminal. The Python Environments extension activates the environment associated with the current workspace or Python project, so python and pip resolve correctly without a manual source .venv/bin/activate. When activation fails, the interpreter selected in the UI and the interpreter used by the shell are two different Pythons.
Why two settings appear to fight over one terminal
There are two generations of activation settings:
-
python.terminal.activateEnvironmentbelongs to the original Python extension. It defaults totrueand controls whether selecting an interpreter also activates it in new terminals. -
python-envs.terminal.autoActivationTypebelongs to the Python Environments extension and acceptscommand,shellStartup, oroff.
The official settings reference is explicit that the legacy setting is superseded by python-envs.terminal.autoActivationType when that setting is configured, and the migration table maps python.terminal.activateEnvironment to the new setting, with "off" as the replacement for disabling activation (Python settings reference). In other words, python.terminal.activateEnvironment is a fallback, not an override. Setting it to true does nothing if the new setting is present and set to off, and setting it to false may not disable activation once the new pipeline is active.
That split explains the confusing reports. Issue #1025 in the Python Environments repository documented Windows users on stable builds who only got activation back after re-enabling both python.terminal.activateEnvironment and python.terminal.activateEnvInCurrentTerminal, even with autoActivationType set to command. The issue was verified and closed, and the fix required the latest VS Code Insiders build plus the pre-release Python Environments extension, so behavior differs by channel and extension version (vscode-python-environments issue #1025). If you are on stable and the legacy flags are the only thing that works, you are probably hitting that version gap rather than misconfiguring your environment.
Before changing either setting, confirm which model your install is actually running. If you are unsure whether an older tutorial still applies to your setup, this current walkthrough of how to auto activate a virtual environment in VS Code covers the modern interpreter-first model and the remaining failure points on Windows, macOS, and Linux.
The precedence check, in order
Work through these steps top to bottom and stop at the first mismatch.
Is the Python Environments extension installed and active? Check the Extensions view for
ms-python.vscode-python-envs. If your build has not switched over yet, the tracking issue for the transition gives the opt-in flag aspython.useEnvironmentsExtensionin user settings, noting that VS Code may mark it as unknown while it still works (vscode-python issue #25291).Is an environment actually selected for this folder? Terminal activation follows the environment chosen for the workspace or Python project, not the last interpreter you happened to run. Microsoft's release announcement describes the selection order: a configured Python project, then an explicitly set default environment manager, then
python.defaultInterpreterPath, then auto-discovery of.venvand system Python (Python Environments extension announcement). In a multi-root workspace, the interpreter for the relevant folder is what matters, so select it in that folder rather than only at workspace level.Is
python-envs.terminal.autoActivationTypeconfigured at all? If it is absent, the legacy setting still governs. If it is present, it wins, regardless ofpython.terminal.activateEnvironment. Note the scope: the environments guide liststerminal.autoActivationTypeas a user-level setting only, so a value placed in workspace settings is ignored. Open the usersettings.jsonto check.Does the chosen mode match your shell?
commandis the current default and runs the activation command visibly after the terminal opens.shellStartupactivates before the first command by editing a shell profile or, forcmd.exe, adding anAutoRunregistry entry.shellStartupis planned to become the default in a future release.Did you restart the terminal? Activation mode changes apply to new terminals. Reusing an existing terminal keeps the old behavior, which is a common reason a fix appears not to work.
Choose an activation mode
| Goal | Setting to use | Why |
|---|---|---|
| Standard setup; visible activation is fine | python-envs.terminal.autoActivationType: "command" (default) | Works across all shells and shows exactly what ran |
| Run Python immediately, or let Copilot/agents run commands | "shellStartup" | Environment is active before the first prompt returns |
| Existing setup works and you have no reason to migrate | Leave python.terminal.activateEnvironment and do not define the new setting | The legacy setting remains the fallback when the new one is unset |
| No automatic activation at all | "off" | The authoritative way to disable activation; do not rely on setting the legacy flag to false |
| Remote session, locked-down shell, or profile edits not allowed | "command" | Avoids modifying startup files; falls back gracefully |
shellStartup depends on shell support. VS Code's shell integration documentation lists bash, fish, pwsh, and zsh on Linux/macOS, and Git Bash and pwsh on Windows (Terminal Shell Integration). The environments extension adds cmd.exe to the supported list by using the registry AutoRun mechanism rather than shell integration. That difference is why PowerShell and cmd can behave differently on the same machine, and why a shellStartup fix that works in one shell may still fail in the other.
Verify the terminal is using the selected interpreter
Do not judge activation by the (.venv) prompt prefix alone. Check the actual interpreter path. Open a new terminal after making changes, then run one of the following.
PowerShell:
python -c "import sys; print(sys.executable); print(sys.prefix)" Write-Output $env:VIRTUAL_ENV Get-Command python | Select-Object -ExpandProperty Source Command Prompt:
python -c "import sys; print(sys.executable); print(sys.prefix)" echo %VIRTUAL_ENV% where python bash or zsh:
python -c 'import sys; print(sys.executable); print(sys.prefix)' printf '%s\n' "$VIRTUAL_ENV" which -a python The strongest signal is sys.executable, which the Python documentation defines as the absolute path of the running interpreter binary (Python sys documentation). It should point inside .venv (for example .../.venv/bin/python or ...\.venv\Scripts\python.exe). sys.prefix should match the environment directory, and sys.prefix != sys.base_prefix confirms you are inside a virtual environment. If sys.executable points at the system Python while VIRTUAL_ENV is set, the shell inherited a stale variable or an activation script ran without changing PATH; do not treat VIRTUAL_ENV as proof.
On Windows, where python and Get-Command python should list the environment's Scripts\python.exe first. On POSIX systems, which -a python should show the environment's bin/python before any system path.
Clean up stale settings and startup scripts
Once activation works, remove the conflicting instructions so the next person (or the next you) does not repeat the diagnosis:
- Delete
python.terminal.activateEnvironmentandpython.terminal.activateEnvInCurrentTerminalfrom user and workspacesettings.jsonif you have moved topython-envs.terminal.autoActivationType. Keeping contradictory values makes future debugging harder. - Check both scopes. A workspace value for
terminal.autoActivationTypeis ignored, so it can silently mask your intended user-level setting. - Set the new setting explicitly rather than depending on the default.
commandis currently the default, but the plan is forshellStartupto become the default, and an explicit value keeps behavior stable across upgrades. - If you tried
shellStartupand want to undo the profile edits, run Python Envs: Revert Shell Startup Script Changes from the Command Palette. The environments guide documents this as the supported rollback (Python environments in VS Code). It removes the injected startup snippets from your shell profile, including theAutoRunentry used forcmd.exe. - If you disabled
terminal.integrated.shellIntegration.enabled, or a shell plugin unsetsVSCODE_SHELL_INTEGRATION,shellStartupmay not inject correctly. Re-enable shell integration or switch tocommandmode. - Reload the VS Code window and open a fresh terminal after cleanup. Old terminals keep their original environment, so testing in a reused tab gives misleading results.
Conclusion
python.terminal.activateEnvironment is not broken so much as demoted. In 2026, python-envs.terminal.autoActivationType is the setting that decides how a terminal gets its environment, and the legacy flag only applies when the new one is unset. Check that the Python Environments extension is installed, confirm the correct environment is selected for the folder, verify the new setting exists in user settings and uses a mode your shell supports, then restart the terminal. Finish by comparing sys.executable with the environment path — that one check tells you whether activation actually happened, regardless of what the prompt claims.
