Skip to content

Virtual environment without activate script does not respect python.terminal.activateEnvironment setting #22898

@tcuisset

Description

@tcuisset

Type: Bug

Behaviour

Expected vs. Actual

Actual

When selecting a Python virtual environment that has no bin/activate script (but has a pyvenv.cfg), then the Python extension will ignore the python.terminal.activateEnvironment setting and always prepend the venv bin directory to path.

Expected

When python.terminal.activateEnvironment=false, then the PATH is not changed (as happens with a regular python venv)

Steps to reproduce:

  1. Set python.terminal.activateEnvironment to false
  2. Run python -m venv venv
  3. Remove venv/bin/activate
  4. Open a new integrated terminal and check the terminal environment changes

Diagnostic data

  • Python version (& distribution if applicable, e.g. Anaconda): 3.10.12
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Venv
  • Value of the python.languageServer setting: Default
Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

XXX

User Settings


languageServer: "Pylance"

terminal
• activateEnvironment: false

Extension version: 2024.0.1
VS Code version: Code 1.86.1 (31c37ee8f63491495ac49e43b8544550fbae4533, 2024-02-07T09:07:19.849Z)
OS version: Linux x64 6.1.0-1033-oem
Modes:
Connection to 'SSH: llruicms01' could not be established Canceled
Remote OS version: Linux x64 6.1.0-1033-oem

System Info
Item Value
CPUs 13th Gen Intel(R) Core(TM) i7-13800H (20 x 2880)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
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: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Load (avg) 1, 1, 1
Memory (System) 62.48GB (47.55GB free)
Process Argv --unity-launch --crash-reporter-id cb172af6-c37b-483a-aabb-8af8f8ef1f33
Screen Reader no
VM 0%
DESKTOP_SESSION ubuntu
XDG_CURRENT_DESKTOP Unity
XDG_SESSION_DESKTOP ubuntu
XDG_SESSION_TYPE x11

Connection to 'SSH: llruicms01' could not be established Canceled

Item Value
Remote Dev Container
OS Linux x64 6.1.0-1033-oem
CPUs 13th Gen Intel(R) Core(TM) i7-13800H (20 x 2829)
Memory (System) 62.48GB (47.55GB free)
VM 0%

Metadata

Metadata

Assignees

Labels

info-neededIssue requires more information from postertriage-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