Skip to content

Python env auto-activation regression: Terminal no longer activates unless legacy settings are enabled #1025

@JVSCHANDRADITHYA

Description

@JVSCHANDRADITHYA

Environment

  • VS Code version: your version

  • Python extension version: your version

  • OS: Windows 10/11

  • Shells tested:

    • PowerShell
    • CMD
    • Git Bash

Summary

After recent Python extension updates (last ~4–5 months), Python environment auto-activation no longer works in Terminals unless the Python Extension settings are explicitly enabled, despite extension stating they are overridden by the new python.envs.terminal.autoActivationType setting.

This is a regression. Behavior was previously consistent.


Actual Behavior

Case 1 — Python Extension settings disabled

python.terminal.activateEnvironment = false
python.terminal.activateEnvInCurrentTerminal = false
python.envs.terminal.autoActivationType = "command" // even shell startup does the same

Opening a CMD terminal results in:

F:\Project>
  • No environment name
  • No activation commands run
  • Running a Python file uses the wrong environment, causing import failures

Expected: Environment auto-activates
Actual: No activation occurs at all


Case 2 — Python Extension settings enabled

python.terminal.activateEnvironment = true
python.terminal.activateEnvInCurrentTerminal = true
python.envs.terminal.autoActivationType = "command"
  • CMD terminal now auto-activates
  • Activation is delayed because commands are queued
  • Running Python before activation results in errors
  • Activation happens only after the script fails

Activation technically occurs, but it is unreliable.


Expected Behavior

Documentation states:

python.envs.terminal.autoActivationType takes precedence over (Python Extension) settings.

Therefore:

  • Auto-activation should work even if legacy settings are disabled
  • Activation should occur before Python execution, not after

Why This Is a Problem

  • Shells cannot auto-activate unless deprecated settings are re-enabled
  • Scripts run with the wrong interpreter when activation is delayed
  • Legacy settings still control activation despite being marked deprecated
  • shellStartup mode does not activate CMD at all
  • command mode activates too late (after execution begins)

This combination makes CMD activation effectively broken.


Reproduction Steps

  1. Disable both legacy settings:
python.terminal.activateEnvironment = false
python.terminal.activateEnvInCurrentTerminal = false
  1. Set:
python.envs.terminal.autoActivationType = "command"
  1. Open a CMD/PWSH terminal in VS Code
  2. Observe that the environment does not activate
  3. Run a Python file
  4. Script fails due to the wrong interpreter
  5. CMD activates the environment only after the failure

Notes

  • PowerShell auto-activation fails
  • CMD behavior has changed recently; it previously worked reliably (CMD Neither works after legacy in case of shellStartup, but that's for another issue)
  • This issue is not related to conda; it also occurs with venv
  • The problem appears specific to VS Code’s Python extension activation logic
  • Many Windows developers depend on CMD for tooling and workflows

Request

Please restore the original behavior:

  • python.envs.terminal.autoActivationType should be authoritative
  • Legacy settings should not be required for activation
  • CMD activation should occur immediately, not after script execution
  • CMD should be fully supported under both shellStartup and command activation modes

Logs can be provided if needed.


Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions