Skip to content

Integrated terminal activates base conda environment instead of configured environment #869

@AntonioDEM

Description

@AntonioDEM

Does this issue occur when all extensions are disabled?: No (This appears to be related to Python extension functionality)

  • VS Code Version: 1.104.0
  • Node.js: 22.18.0
  • OS Version: Darwin x64 23.6.0, Sonoma 14.6.1 (23G93)

Issue Description

VS Code fails to automatically activate the correct conda environment in integrated terminal despite python.terminal.activateEnvironment: true setting and correct Python interpreter configuration.

Steps to Reproduce:

  1. Install conda/miniconda and create a conda environment (e.g., conda create -n node-dev python=3.x)
  2. Open VS Code and create a new workspace/project
  3. Configure workspace settings:
    {
        "python.defaultInterpreterPath": "/Users/[username]/miniconda3/envs/node-dev/bin/python",
        "python.condaPath": "/Users/[username]/miniconda3/bin/conda",
        "python.terminal.activateEnvironment": true,
        "terminal.integrated.inheritEnv": false
    }
  4. Verify the correct Python interpreter is selected (should show in status bar)
  5. Open a new integrated terminal (`Cmd+``)
  6. Observe the terminal prompt and run echo $CONDA_DEFAULT_ENV

Expected Result:

  • Terminal should show (node-dev) in prompt
  • echo $CONDA_DEFAULT_ENV should output node-dev
  • VS Code should automatically activate the conda environment specified by the Python interpreter

Actual Result:

  • Terminal shows (base) in prompt (or no environment activated)
  • echo $CONDA_DEFAULT_ENV outputs base (or empty)
  • The base conda environment is activated instead of the configured one
  • Manual conda activate node-dev works correctly

Additional Information:

Environment Details:

  • Shell: zsh (default on macOS)
  • Conda properly initialized in .zshrc
  • which conda returns a shell function (normal conda setup)
  • Python extension correctly identifies the interpreter (visible in status bar)

Configuration Files:

// Workspace settings
{
    "python.defaultInterpreterPath": "/Users/tony/miniconda3/envs/node-dev/bin/python",
    "python.condaPath": "/Users/tony/miniconda3/bin/conda",
    "python.terminal.activateEnvironment": true,
    "terminal.integrated.inheritEnv": false
}

Workaround that works:
Creating a custom terminal profile manually activates the correct environment:

{
    "terminal.integrated.defaultProfile.osx": "conda-env",
    "terminal.integrated.profiles.osx": {
        "conda-env": {
            "path": "/bin/zsh",
            "args": ["-l", "-c", "conda activate node-dev; exec zsh"]
        }
    }
}

However, this shouldn't be necessary when python.terminal.activateEnvironment: true is configured.

Tested scenarios:

  • ✅ Custom terminal profile with manual conda activate
  • python.terminal.activateEnvironment: true (should work but doesn't)
  • ❌ Various terminal.integrated.env.osx configurations
  • ✅ Manual activation after terminal opens

This issue affects productivity as developers need to manually activate the correct environment every time they open a new terminal, despite having the correct configuration.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions