Skip to content

Terminal python launch command not working ? or not stable ? #25293

Description

@fredmelka

Type: Bug

In Terminal
While launching a python file, the interpreter is not using the selected interpreter from the environment (conda env).
Instead it remains using the default recommended version and environment.

VS Code version: Code 1.102.1 (7adae6a56e34cb64d08899664b814cf620465925, 2025-07-15T16:41:17.147Z)
OS version: Windows_NT x64 10.0.26100
Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz (8 x 1800)
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) 7.85GB (0.97GB free)
Process Argv --crash-reporter-id 1adf530d-240f-4815-a02d-bd92d76b331a
Screen Reader no
VM 0%
Extensions (4)
Extension Author (truncated) Version
debugpy ms- 2025.10.0
python ms- 2025.10.0
vscode-pylance ms- 2025.6.2
LiveServer rit 5.7.9
A/B Experiments
vsliv368cf:30146710
binariesv615:30325510
962ge761:31349326
h48ei257:31000450
nativeloc1:31344060
5fd0e150:31155592
dwcopilot:31170013
6074i472:31201624
dwoutputs:31242946
9064b325:31222308
copilot_t_ci:31333650
e5gg6876:31282496
pythoneinst12:31285622
c7cif404:31314491
pythonpulldiag:31343502
996jf627:31283433
pythonrdcb7:31342333
usemplatestapi:31297334
0aa6g176:31307128
747dc170:31275177
aj953862:31281341
generatesymbolt:31295002
convertfstringf:31295003
9d2cg352:31346308
usemarketplace:31343026
nesew2to5:31336538
agentclaude:31335815
nes-diff-11:31337487
i62hb738-off:31348503
66g5g415:31348965
nes-set-on:31349227
onetestforazureexp:31335613
6abeh943:31336334
yijiwantestdri0626-c:31336931
0927b901:31349830
ji9b5146:31348712
0ej4-default:31346761
0cj2b977:31349835
7ji1b882:31349954

Activity

  1. huixuanling commented on Jul 17, 2025

    @huixuanling

    I encountered the same issue. After selecting the interpreter in the bottom right corner, the terminal shows the current conda virtual environment next to the username. However, this environment is invalid. When I run Python-related commands, it still uses the system’s default Python interpreter. Only after manually activating the desired virtual environment again in the terminal does the correct Python interpreter take effect.

  2. fredmelka commented on Jul 17, 2025

    @fredmelka
    Author

    Hello!
    Thanks for sharing.
    Could you explicitly say how you "manually activated the desired virtual environment again" ??
    I have been trying to do so for hours now and still when I launch a file like so "python file.py" from a terminal (in VS) then a default environment is used and none of the libraries are found (e.g. numpy etc.)
    Thanks for your help!

  3. changed the title [-]Terminal python launch command not working[/-] [+]Terminal python launch command not working ? or not stable ?[/+] on Jul 17, 2025
  4. fredmelka commented on Jul 17, 2025

    @fredmelka
    Author

    Following huixuanling's advice, it turns out indeed that the correct environment is effectively loaded only once it is manually re-activated (e.g. conda activate ...).

    Let's point out that the environment is not correct even though now the name is properly prompted on the terminal (this is new to me).

    However it looks this manual override must be done each time a terminal session is opened...

    Can someone please advise and help ? Thanks

  5. wangyexiang commented on Jul 18, 2025

    @wangyexiang

    As for me, I turn off the Python Debugger extension. It works!

  6. huaium commented on Jul 18, 2025

    @huaium

    The same issue for me, and I noticed that Run Python File in Terminal works fine. Only when the terminal is manually opened does the issue occur.

  7. huaium commented on Jul 18, 2025

    @huaium

    As for me, I turn off the Python Debugger extension. It works!

    It also works for me!

  8. fredmelka commented on Jul 18, 2025

    @fredmelka
    Author

    Thanks for feedbacks!
    Looks like the issue is being escalated by MS teams: see issues #25291 and #25284. Some fixes as of now:

    • roll back to VS code version 101 until fix is properly handled
    • opt out from this update by adding this line in file ./.vscode/settings.json
    • manually activate the environment at terminal launch session
    • disable python debugger

    On my side I have chosen to manually activate each time the environment in order to keep track of the coming fix.

  9. Chocay commented on Jul 21, 2025

    @Chocay

    As for me, I turn off the Python Debugger extension. It works!

    me too, thanks! It has been bothering me for several days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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