Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

default Interpreter path is not respected when i open a project #23880

Open
ManiMozaffar opened this issue Jul 29, 2024 · 4 comments
Open

default Interpreter path is not respected when i open a project #23880

ManiMozaffar opened this issue Jul 29, 2024 · 4 comments
Assignees
Labels
area-environments Features relating to handling interpreter environments bug Issue identified by VS Code Team member as probable bug triage-needed Needs assignment to the proper sub-team

Comments

@ManiMozaffar
Copy link

Type: Bug

Behaviour

VSCode doesn't respect the value i set in my user setting json. Idh similiar setting in workspace, so that's not what causing issue. it always show up as suggestion, but not as acitvated.
"python.defaultInterpreterPath": "${workspaceFolder}/.venv",
i have it like this

XXX

Steps to reproduce:

  1. Not sure how, it just happens randomly alot. set a default interpreter path, and open serval different project, you'd see it doesn't always respect that.
    "python.defaultInterpreterPath": "${workspaceFolder}/.venv",

Diagnostic data

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

XXX

Extension version: 2024.10.0
VS Code version: Code 1.91.1 (f1e16e1e6214d7c44d078b1f0607b2388f29d729, 2024-07-09T22:07:46.768Z)
OS version: Darwin arm64 23.2.0
Modes:

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


languageServer: "Pylance"

testing
• pytestArgs: "<placeholder>"
• pytestEnabled: true

Installed Extensions
Extension Name Extension Id Version
autoDocstring - Python Docstring Generator njpwerner.autodocstring 0.6.1
Babel JavaScript mgmcdermott.vscode-language-babel 0.0.40
Biome biomejs.biome 2.3.0
Dev Containers ms-vscode-remote.remote-containers 0.375.1
Django batisteo.vscode-django 1.15.0
Docker ms-azuretools.vscode-docker 1.29.1
Draw.io Integration hediet.vscode-drawio 1.6.6
ES7+ React/Redux/React-Native snippets dsznajder.es7-react-js-snippets 4.4.3
Even Better TOML tamasfe.even-better-toml 0.19.2
Fig withfig.fig 0.0.7
File Utils sleistner.vscode-fileutils 3.10.3
Git Graph mhutchie.git-graph 1.30.0
Git History donjayamanne.githistory 0.6.20
GitHub Copilot GitHub.copilot 1.219.0
GitHub Copilot Chat GitHub.copilot-chat 0.17.1
gitignore codezombiech.gitignore 0.9.0
GitLens — Git supercharged eamodio.gitlens 15.2.3
Gitmoji seatonjiang.gitmoji-vscode 1.2.5
HTMLHint HTMLHint.vscode-htmlhint 1.0.5
JavaScript and TypeScript Nightly ms-vscode.vscode-typescript-next 5.6.20240727
JavaScript Debugger ms-vscode.js-debug 1.91.0
JavaScript Debugger Companion Extension ms-vscode.js-debug-companion 1.1.2
Jupyter ms-toolsai.jupyter 2024.6.0
Jupyter Cell Tags ms-toolsai.vscode-jupyter-cell-tags 0.1.9
Jupyter Keymap ms-toolsai.jupyter-keymap 1.1.2
Jupyter Notebook Renderers ms-toolsai.jupyter-renderers 1.0.18
Jupyter Slide Show ms-toolsai.vscode-jupyter-slideshow 0.1.6
NPM idered.npm 1.7.4
npm Intellisense christian-kohler.npm-intellisense 1.4.5
Prettier - Code formatter esbenp.prettier-vscode 10.4.0
Prettier ESLint rvest.vs-code-prettier-eslint 6.0.0
Prettier SQL VSCode inferrinizzard.prettier-sql-vscode 1.6.0
Pulumi YAML pulumi.pulumi-lsp-client 0.2.3
Pylance ms-python.vscode-pylance 2024.7.1
Python ms-python.python 2024.10.0
Python Debugger ms-python.debugpy 2024.8.0
Python Development Extensions Pack demystifying-javascript.python-extensions-pack 1.0.3
Python Extension Pack donjayamanne.python-extension-pack 1.7.0
Python Resource Monitor kaih2o.python-resource-monitor 0.2.3
Python Test Explorer for Visual Studio Code littlefoxteam.vscode-python-test-adapter 0.8.2
Python Type Hint njqdev.vscode-python-typehint 1.5.1
Remote - SSH ms-vscode-remote.remote-ssh 0.112.0
Remote - SSH: Editing Configuration Files ms-vscode-remote.remote-ssh-edit 0.86.0
Remote Explorer ms-vscode.remote-explorer 0.4.3
Ruff charliermarsh.ruff 2024.36.0
rust 1YiB.rust-bundle 1.0.0
Rust Syntax dustypomerleau.rust-syntax 0.6.1
rust-analyzer rust-lang.rust-analyzer 0.3.2053
Simple React Snippets burkeholland.simple-react-snippets 1.2.8
Table Visualizer for JavaScript Profiles ms-vscode.vscode-js-profile-table 1.0.9
Test Adapter Converter ms-vscode.test-adapter-converter 0.1.9
Test Explorer UI hbenl.vscode-test-explorer 2.21.1
vscode-icons vscode-icons-team.vscode-icons 12.8.0
vscode-rustfmt statiolake.vscode-rustfmt 0.2.0
YAML redhat.vscode-yaml 1.15.0
ytt lint phil9909.ytt-lint 0.3.1
System Info
Item Value
CPUs Apple M2 Pro (10 x 2400)
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
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) 3, 7, 7
Memory (System) 16.00GB (0.73GB free)
Process Argv --crash-reporter-id 7f3e3d6a-a02d-4b47-a7bb-7855a1921520
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805:30301674
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
a9j8j154:30646983
962ge761:30959799
pythongtdpath:30769146
welcomedialogc:30910334
pythonnoceb:30805159
asynctok:30898717
pythonregdiag2:30936856
pythonmypyd1:30879173
h48ei257:31000450
pythontbext0:30879054
accentitlementsc:30995553
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
945dj816:31013170
pythoncenvpt:31062603
a69g1124:31058053
dvdeprecation:31068756
dwnewjupytercf:31046870
2f103344:31071589
impr_priority:31102340
nativerepl1:31104043
refactort:31101459
ccplt:31103426
pythonrstrctxt:31103193

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Jul 29, 2024
@karthiknadig karthiknadig self-assigned this Jul 29, 2024
@karthiknadig
Copy link
Member

karthiknadig commented Jul 31, 2024

@ManiMozaffar The python.defaultInterpreterPath should point to a binary, not just the .venv folder. it should be something like .venv/bin/python. Also, if you have a .venv in a workspace it should be auto selected. you don't need to add the python.defaultInterpreterPath to make it select it.

@karthiknadig
Copy link
Member

Actually, could you share the logs from Output > Python

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Jul 31, 2024
@ManiMozaffar
Copy link
Author

@ManiMozaffar The python.defaultInterpreterPath should point to a binary, not just the .venv folder. it should be something like .venv/bin/python. Also, if you have a .venv in a workspace it should be auto selected. you don't need to add the python.defaultInterpreterPath to make it select it.

It actually does work. bcs when I'm trying to select interepeter, I see that first option is the correct python path, but mentioned "from default path". so I guess vscode is smartly trying to find python binary

Actually, could you share the logs from Output > Python

I can't reproduce it right now, it works now. but sometimes it happen. next time if it happened, i'd share the logs with you here.
I think it would be useful to have a setting called 'Interpreter Path' where users can specify a custom path instead of using the 'default' interpreter. VSCode could then use this specified path to activate the appropriate virtual environment if available. This would clarify the difference between the 'Interpreter Path' and the 'default Interpreter Path', especially given the presence of the suggestion bar, which seems to imply the existence of a specific interpreter path selection

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Aug 1, 2024
@ManiMozaffar
Copy link
Author

ManiMozaffar commented Aug 5, 2024

I think i know what's going on @karthiknadig

So I'm setting the default like this: "${workspaceFolder}/.venv" which is using "dynamic" path per project.

then it appear on my suggestion bar as recommended per setting, so when I pick it, it overwrite that path with absolute path that point to a certain project venv.
having a stupid "Interpreter Path" which just get respected everytime on all project is also ideally very good as my last comment.

@eleanorjboyd eleanorjboyd added bug Issue identified by VS Code Team member as probable bug area-environments Features relating to handling interpreter environments labels Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-environments Features relating to handling interpreter environments bug Issue identified by VS Code Team member as probable bug triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

3 participants