Skip to content

Running Python file in Conda environment opens flash terminal with transient output, unlike base environment #25397

@Kendr1ckFu

Description

@Kendr1ckFu

Type: Bug

Behaviour

When running a Python file in a Conda environment created via conda create, the execution command is split into two steps:

  1. > activate.bat py312
  2. > conda run --live-stream --name py312 python {python_file_path}

This maybe causes the output to appear in what seems like a separate, transient terminal (or subprocess) that flashes and closes quickly, then call the origin terminal back. As a result:

  • Standard output flashes and disappears.
  • Cannot see and scroll through output using the mouse wheel.
  • Poor user experience compared to running in the base/global environment.

In contrast, when using the global (base) Python environment instead of conda, the command is simply:

> python.exe {python_file_path}

and the output is displayed properly within the integrated VS Code terminal, allowing full interaction (scrolling, viewing, etc.).

Expected behavior: Output should be shown directly in the VS Code integrated terminal for all environments, without spawning transient external windows.

Steps to reproduce:

  1. Create a new conda environment: conda create -n py312 python=3.12
  2. Activate the environment in VS Code (via Command Palette → "Python: Select Interpreter" and choose the interpreter from py312)
  3. Open a simple Python file (e.g., one with print("Hello"))
  4. Run the file using the "Run Python File" button (▶️) in the top-right corner or via right-click → "Run Python File in Terminal"
  5. Observe that the output flashes briefly and cannot be scrolled, while the terminal shows the two-step activation and conda run command
  6. Switch to the base environment's interpreter and repeat step 4 — observe that output now persists and is scrollable

--

Extension version: 2025.12.0
VS Code version: Code 1.102.3 (488a1f239235055e34e673291fb8d8c810886f81, 2025-07-29T03:00:23.339Z)
OS version: Windows_NT x64 10.0.19045
Modes:

  • Python version (& distribution if applicable, e.g. Anaconda): 3.12.6
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): System
  • Value of the python.languageServer setting: Default
User Settings


languageServer: "Pylance"

Installed Extensions
Extension Name Extension Id Version
black-formatter ms- 2025.2.0
copilot Git 1.356.1735
copilot-chat Git 0.29.1
debugpy ms- 2025.10.0
fn-map che 8.5.1
js-debug ms- 1.102.0
js-debug-companion ms- 1.1.3
material-icon-theme PKi 5.25.0
python ms- 2025.12.0
sqlite-viewer qwt 0.10.6
svn-scm joh 2.17.0
theme-dracula dra 2.25.1
vscode-js-profile-table ms- 1.0.10
vscode-language-pack-zh-hans MS- 1.102.2025071609
vscode-pylance ms- 2025.7.1
vscode-python-envs ms- 1.2.0
System Info
Item Value
CPUs 13th Gen Intel(R) Core(TM) i5-13400 (16 x 2496)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 15.62GB (5.74GB free)
Process Argv --crash-reporter-id 9a7680a8-1840-427c-9b3f-816755953f06
Screen Reader no
VM 50%
A/B Experiments
vsliv368:30146709
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythoneinst12:31285622
996jf627:31283433
pythonrdcb7:31342333
usemplatestapi:31297334
747dc170:31275177
aj953862:31281341
9d2cg352:31346308
convertlamdaf:31368658
usemarketplace:31343026
nesew2to5:31336538
agentclaude:31350858
replacestringexc:31350595
nes-set-on:31351930
6abeh943:31336334
envsactivate1:31353494
yijiwantestdri0626-t:31336930
0927b901:31350571
ji9b5146:31348712
45650338:31358607
0cj2b977:31352657
retrydisabled:31368125

Metadata

Metadata

Assignees

Labels

triage-neededNeeds assignment to the proper sub-team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions