X Tutup
Skip to content

When opening a new terminal, Python venv is activated twice #1325

@mistalaba

Description

@mistalaba

This started recently. Whenever I open a new terminal window, the command source /home/vscode/.venv/bin/activate is run twice. The second one runs after a few seconds, which mean it manages to interrupt whatever I'm typing at the moment.
Here's what it looks like in the terminal (bash):

source /home/vscode/.venv/bin/activate
vscode ➜ /workspace (fix-uploaded-files-same-name) $ source /home/vscode/.venv/bin/activate
(.venv) vscode ➜ /workspace (fix-uploaded-files-same-name) $  source /home/vscode/.venv/bin/activate
(.venv) vscode ➜ /workspace (fix-uploaded-files-same-name) $ 

Output for the Python Environments extension:

2026-03-06 09:14:44.127 [debug] Activating terminal: /home/vscode/.venv/bin/python
2026-03-06 09:14:44.144 [debug] Shell execution started:  source /home/vscode/.venv/bin/activate
2026-03-06 09:14:44.144 [info] Terminal is activated: /home/vscode/.venv/bin/python

Output for the Python extension:

2026-03-06 09:14:43.907 [debug] Terminal name '' identified as shell 'other'
2026-03-06 09:14:43.907 [debug] Terminal shell path '/bin/bash' identified as shell 'bash'
2026-03-06 09:14:43.907 [debug] Shell identified as bash (Terminal name is )
2026-03-06 09:14:43.909 [debug] could not find a pixi interpreter for the interpreter at /home/vscode/.venv/bin/python
2026-03-06 09:14:43.943 [debug] Command sent to terminal: source /home/vscode/.venv/bin/activate
2026-03-06 09:14:43.943 [info] Send text to terminal: source /home/vscode/.venv/bin/activate
2026-03-06 09:14:44.154 [debug] Received shell integration sequence for bash
2026-03-06 09:14:44.201 [debug] Received shell integration sequence for bash
2026-03-06 09:14:48.997 [debug] Received shell integration sequence for bash

I'm using VSCode on Windows with a devcontainer in WSL2. Please let me know if you need more context.

EDIT: I added logging for Python extension as well
EDIT 2: Looking at the settings, the Python extension had "Activate environment" enabled. But disabling that, then the Python Environments extension did not activate the environment at all.

Metadata

Metadata

Assignees

Labels

area-activationIssue related to activation. Root cause can be from interpreter selection or activation in terminalarea-terminalEnvironment extension specific terminal issues.bugIssue identified by VS Code Team member as probable buginfo-neededIssue requires more information from poster

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    X Tutup