Type: Bug
Behaviour
When I open VSCode the python interpreter selected is inconsistent. It certainly to depends on:
- What python environment I have set in the terminal I launch it
I am not certain if other things also affect it, for a while I thought it was the history of what I did last time I had vscode open (as persistent terminals also caused me issues, but this I cannot reproduce). I have had continued issues with getting environments to persist in workspaces since the interpreter settings were changed from the settings.json a couple of years back 2022.
Every time I open a project I have to use "Python: Select Interpreter" again. I assume part of the problem is that the way my system is configured, I almost always have a python virtual environment activated. As I always launch vscode from the terminal, it seems to try to use the interpreter from the environment I launched it from, rather than the interpreter I have set.
I understand that this may be a feature not a bug, some people may want the virtual environment from the launching terminal to override workspace settings. The ideal solution would be a global settings in settings.json to never try to guess my python interpreter from virtual environments. Or anything else except how I set it for the workspace (or my default interpreter setting).
Steps to reproduce:
- Open VSCode
- Set interpreter with "Python: Select Interpreter"
- Close VSCode
- Open a new terminal
- If this terminal doesn't have a Python venv running then start one (mine always does from my
.bashrc)
- Navigate to the workspace directory
- run
code .
- The interpreter is not the one that was set selected for the workspace 😢
Diagnostic data
Extension version: 2024.10.0
VS Code version: Code 1.90.2 (5437499feb04f7a586f677b155b039bc2b3669eb, 2024-06-18T22:33:48.698Z)
OS version: Linux x64 5.4.0-182-generic
Modes:
- Python version (& distribution if applicable, e.g. Anaconda): 3.10.13
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Venv
- Value of the
python.languageServer setting: None
User Settings
Installed Extensions
| Extension Name |
Extension Id |
Version |
| Better Jinja |
samuelcolvin.jinjahtml |
0.20.0 |
| isort |
ms-python.isort |
2023.10.1 |
| JavaScript Debugger |
ms-vscode.js-debug |
1.90.0 |
| JavaScript Debugger Companion Extension |
ms-vscode.js-debug-companion |
1.1.2 |
| Jupyter |
ms-toolsai.jupyter |
2024.5.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 |
| Lark grammar syntax support |
dirk-thomas.vscode-lark |
0.1.0 |
| Live Share |
ms-vsliveshare.vsliveshare |
1.0.5936 |
| Markdown All in One |
yzhang.markdown-all-in-one |
3.6.2 |
| Markdown Preview Enhanced |
shd101wyy.markdown-preview-enhanced |
0.8.13 |
| OpenSCAD |
Antyos.openscad |
1.3.1 |
| Pylint |
ms-python.pylint |
2023.10.1 |
| Python |
ms-python.python |
2024.10.0 |
| Python Debugger |
ms-python.debugpy |
2024.8.0 |
| 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 |
| Table Visualizer for JavaScript Profiles |
ms-vscode.vscode-js-profile-table |
1.0.9 |
| Vue - Official |
Vue.volar |
2.0.8 |
System Info
| Item |
Value |
| CPUs |
Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz (4 x 2900) |
| 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) |
15.39GB (6.09GB free) |
| Process Argv |
. |
| Screen Reader |
no |
| VM |
0% |
| DESKTOP_SESSION |
plasma |
| XDG_CURRENT_DESKTOP |
KDE |
| XDG_SESSION_DESKTOP |
KDE |
| XDG_SESSION_TYPE |
x11 |
Type: Bug
Behaviour
When I open VSCode the python interpreter selected is inconsistent. It certainly to depends on:
I am not certain if other things also affect it, for a while I thought it was the history of what I did last time I had vscode open (as persistent terminals also caused me issues, but this I cannot reproduce). I have had continued issues with getting environments to persist in workspaces since the interpreter settings were changed from the
settings.jsona couple of years back 2022.Every time I open a project I have to use "Python: Select Interpreter" again. I assume part of the problem is that the way my system is configured, I almost always have a python virtual environment activated. As I always launch vscode from the terminal, it seems to try to use the interpreter from the environment I launched it from, rather than the interpreter I have set.
I understand that this may be a feature not a bug, some people may want the virtual environment from the launching terminal to override workspace settings. The ideal solution would be a global settings in settings.json to never try to guess my python interpreter from virtual environments. Or anything else except how I set it for the workspace (or my default interpreter setting).
Steps to reproduce:
.bashrc)code .Diagnostic data
Extension version: 2024.10.0
VS Code version: Code 1.90.2 (5437499feb04f7a586f677b155b039bc2b3669eb, 2024-06-18T22:33:48.698Z)
OS version: Linux x64 5.4.0-182-generic
Modes:
python.languageServersetting: NoneUser Settings
Installed Extensions
System Info
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