Skip to content

Python env resolver ignores user specified interpreter #24767

@dta-bdai

Description

@dta-bdai

Type: Bug

We have a wrapper around a Bazel generated script that launches the Python interpreter inside Bazel with all environment variables and Python paths setup properly, pointing to the correct locations of Python packages and dependencies inside Bazel runfiles dir. The technique is similar to this: https://sransara.com/notes/2023/bazel-python-venv/

We point VSCode Python interpreter to the wrapper script, and it used to work well.

Since version 2024.18.0, this workflow does not work anymore. Python extension ignores the wrapper we specified and automatically finds and switches to the bare python interpreter in the script runfiles dir, which doesn't have any path setup.

Is there a way to revive the old mechanism, i.e. forcing VSCode to respect the user-specified Python interpreter path?

Extension version: 2024.22.2
VS Code version: Code 1.96.2 (fabdb6a30b49f79a7aba0f2ad9df9b399473380f, 2024-12-19T10:22:47.216Z)
OS version: Linux x64 6.8.0-51-generic
Modes:
Remote OS version: Linux x64 6.8.0-1017-gcp

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


languageServer: "Pylance"

Installed Extensions
Extension Name Extension Id Version
Bazel BazelBuild.vscode-bazel 0.11.0
Black Formatter ms-python.black-formatter 2024.4.0
GitHub Pull Requests GitHub.vscode-pull-request-github 0.102.0
Image Manager Minko.image-manager 2.3.13
Image Viewer vscode-infra.image-viewer 1.6.5
JavaScript Debugger ms-vscode.js-debug 1.96.0
Jupyter ms-toolsai.jupyter 2024.11.0
Jupyter Cell Tags ms-toolsai.vscode-jupyter-cell-tags 0.1.9
Jupyter Notebook Renderers ms-toolsai.jupyter-renderers 1.0.21
Jupyter Slide Show ms-toolsai.vscode-jupyter-slideshow 0.1.6
Pylance ms-python.vscode-pylance 2024.12.1
Python ms-python.python 2024.22.2
Python Debugger ms-python.debugpy 2024.14.0
Table Visualizer for JavaScript Profiles ms-vscode.vscode-js-profile-table 1.0.10
System Info
Item Value
CPUs 13th Gen Intel(R) Core(TM) i7-1365U (12 x 1360)
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: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
webnn: disabled_off
Load (avg) 1, 1, 1
Memory (System) 31.00GB (16.96GB free)
Process Argv --crash-reporter-id ec7e8904-7db5-4f73-ba38-b9376943463d
Screen Reader no
VM 0%
DESKTOP_SESSION ubuntu
XDG_CURRENT_DESKTOP Unity
XDG_SESSION_DESKTOP ubuntu
XDG_SESSION_TYPE x11
Item Value
Remote Container ghcr.io/bdaiinstitute/dmm_amd64:main (starfish-develop) @ vm2-local
OS Linux x64 6.8.0-1017-gcp
CPUs Intel(R) Xeon(R) CPU @ 2.30GHz (32 x 0)
Memory (System) 117.91GB (108.33GB free)
VM 0%
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyt551cf:31179979
vscod805cf:30301675
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:31024239
vscaac:30438847
c4g48928:30535728
azure-dev_surveyonecf:30548226
vscrpc:30673769
a9j8j154:30646983
962ge761:30959799
pythonnoceb:30805159
pythonmypyd1:30879173
h48ei257:31000450
pythontbext0:30879054
cppperfnew:31000557
dwnewjupyter:31046869
nativerepl2:31139839
pythonrstrctxt:31112756
nativeloc2:31192216
iacca1:31171482
5fd0e150:31155592
dwcopilot:31170013
stablechunks:31184530
6074i472:31201624
dwoutputs:31217127
hdaa2157:31222309
copilot_t_ci:31222730

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugneeds spikeLabel for issues that need investigation before they can be worked on.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions