-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
Note: I cannot file a bug report through VS Code because I get the error
Cannot read properties of undefined (reading 'localeCompare')when clicking thePython: Report Issue…action.
When I open a new Python project in VS Code, I always get the same default interpreter, which is a Poetry environment that I actually only use for a particular project. However, it gets auto-selected for every Python project, even one that I haven't loaded before:
I am using:
- Python extension v2024.8.0
- VS Code Version: 1.90.0, Commit: 89de5a8d4d6205e5b11647eb6a74844ca23d2573
- macOS 14.5 (23F79)
I have set the following custom setting:
"python.venvPath": "~/.cache/pypoetry/virtualenvs, ~/Library/Caches/pypoetry/virtualenvs",
pyenv global is set to 3.11, so which python in a default shell points to /Users/werner/.pyenv/versions/3.11.7/bin/python3. I would expect VS Code to either pick that one for me, or at least the Homebrew-installed one, but definitely not a random Poetry environment.
I do not want to set a default interpreter manually — it's the automatic selection process that appears to broken here.
Here is the Python output:
2024-06-11 13:44:22.192 [info] Experiment 'pythonCreateEnvOnPipInstall' is active
2024-06-11 13:44:22.192 [info] Experiment 'pythonRecommendTensorboardExt' is active
2024-06-11 13:44:22.192 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2024-06-11 13:44:22.193 [info] Experiment 'pythonTestAdapter' is active
2024-06-11 13:44:22.193 [info] Default formatter is set to charliermarsh.ruff for workspace /Users/werner/Documents/Projects/foo
2024-06-11 13:44:22.193 [info] Python interpreter path: ~/Library/Caches/pypoetry/virtualenvs/distribute-speedtests-TZ9Wh3QD-py3.11/bin/python
2024-06-11 13:44:22.237 [info] > pyenv which python
2024-06-11 13:44:22.237 [info] cwd: .
2024-06-11 13:44:22.423 [info] > . ~/Library/Caches/pypoetry/virtualenvs/distribute-speedtests-TZ9Wh3QD-py3.11/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2024.8.0/python_files/printEnvVariables.py
2024-06-11 13:44:22.423 [info] shell: zsh
2024-06-11 13:44:22.498 [info] > /usr/bin/python3 ~/.vscode/extensions/ms-python.python-2024.8.0/python_files/printEnvVariables.py
2024-06-11 13:44:22.498 [info] shell: zsh
2024-06-11 13:44:22.580 [info] Prepending environment variable PATH in collection with /Users/werner/.vscode/extensions/ms-python.python-2024.8.0/python_files/deactivate/zsh:/Users/werner/Library/Caches/pypoetry/virtualenvs/distribute-speedtests-TZ9Wh3QD-py3.11/bin: {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-06-11 13:44:22.580 [info] Setting environment variable VIRTUAL_ENV in collection to /Users/werner/Library/Caches/pypoetry/virtualenvs/distribute-speedtests-TZ9Wh3QD-py3.11 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-06-11 13:44:22.580 [info] Setting environment variable VIRTUAL_ENV_PROMPT in collection to distribute-speedtests-py3.11 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-06-11 13:44:22.580 [info] Prepending environment variable PS1 in collection with distribute-speedtests-py3.11 {"applyAtShellIntegration":true,"applyAtProcessCreation":false}
2024-06-11 13:44:22.581 [info] Send text to terminal: /usr/bin/python3 /Users/werner/.vscode/extensions/ms-python.python-2024.8.0/python_files/printEnvVariablesToFile.py /Users/werner/.vscode/extensions/ms-python.python-2024.8.0/python_files/deactivate/zsh/envVars.txt
2024-06-11 13:44:23.597 [info] Starting Pylance language server.