Repository navigation
Description
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.languageServersetting: 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
Activity
karthiknadig commentedon Feb 3, 2025
Duy Ta (@dta-bdai) Can you share the logs with the broken case? share the Output > Python, and Output> Python Locator logs.
The work around is to use
python.locatortojs. But note that it is our old locator, it is getting replaced withnativelocator. So the logs you provide will be help full in make sure this is supported.dta-bdai commentedon Feb 3, 2025
Thanks! Confirmed that
jslocator doesn't suffer from this problem.Here are the logs for the
nativelocator:Output > Python:
Output > Python Locator:
The path I chose is
/home/dta/starfish/bazel-bin/my_python, and it's automatically resolved to/home/dta/starfish/bazel-bin/my_python.runfiles/rules_python~~python~python_3_10_x86_64-unknown-linux-gnu/bin/python.github-actions commentedon Mar 6, 2025
Hey Karthik Nadig (@karthiknadig), this issue might need further attention.
Duy Ta (@dta-bdai), you can help us out by closing this issue if the problem no longer exists, or adding more information.
afeld commentedon Mar 18, 2025
Possibly related: #23833
TSonono commentedon Sep 16, 2025
We have a similar use case where we have a wrapper to a python executable that sets applicable environment variables and this has been working fine before. I also cannot set the
python.locatorsetting in my workspace nor user settings JSON (I'm seeing this: "This setting can only be applied in user settings in local window or in remote settings in remote window.").
I have one vscode client which is seemingly not using the native locator, but in a fresh install of vs code I got the native locator and that's where I'm running into this issue.
Karthik Nadig (@karthiknadig) any idea if this will be fixed anytime soon?
eleanorjboyd commentedon Dec 8, 2025
Hi! We are moving to use the Python Environments extension. Are you able to try it with this enabled and let me know how it looks there? I can transfer it if there are still issues to then get addressed on that side
github-actions commentedon Jan 8, 2026
Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on, then we will be happy to re-open this issue to pick up where we left off.
Happy Coding!
afeld commentedon Jan 8, 2026
New extension is working for me, thanks!