forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Labels
area-environmentsFeatures relating to handling interpreter environmentsFeatures relating to handling interpreter environmentsfeature-requestRequest for new features or functionalityRequest for new features or functionalityneeds community feedbackAwaiting community feedbackAwaiting community feedbackverifiedVerification succeededVerification succeeded
Milestone
Description
Original title: Visual Studio Code doesn't select the correct Python interpreter at launch
[Kubuntu 22.04]
To fix it I have to manually select the first interpreter with the 'star' and 'Recommended' tag from the list, however it appears to be already selected (bottom right 3.10.6 ('.venv':venv)) after launch.
Steps to reproduce:
$ mkdir venvtest
$ cd venvtest
$ python3 -m venv .venv
$ source .venv/bin/activate
$ pip install numpy
$ touch ptest.py
$ code .
Python: Show Language Server Output:
[Info - 1:44:07 PM] (21220) Pylance language server 2023.2.10 (pyright 01758105) starting
[Info - 1:44:07 PM] (21220) Server root directory: /home/username/.vscode/extensions/ms-python.vscode-pylance-2023.2.10/dist
[Info - 1:44:07 PM] (21220) Starting service instance "venvtest"
[Info - 1:44:07 PM] (21220) No configuration file found.
[Info - 1:44:07 PM] (21220) No pyproject.toml file found.
[Info - 1:44:07 PM] (21220) Setting pythonPath for service "venvtest": "/home/username/Desktop/Tests/Python/venvtest/.venv"
[Warn - 1:44:07 PM] (21220) stubPath /home/username/Desktop/Tests/Python/venvtest/typings is not a valid directory.
[Info - 1:44:07 PM] (21220) Assuming Python platform Linux
[Info - 1:44:07 PM] (21220) Searching for source files
[Info - 1:44:07 PM] (21220) Found 1 source file
[Info - 1:44:07 PM] (21220) Background analysis(1) root directory: /home/username/.vscode/extensions/ms-python.vscode-pylance-2023.2.10/dist
[Info - 1:44:07 PM] (21220) Background analysis(1) started
Edit (1): Python: Report Issue...
Type: Bug
Diagnostic data
- Python version (& distribution if applicable, e.g. Anaconda): 3.10.6
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Venv
- Value of the
python.languageServersetting: Default
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
XXX
User Settings
languageServer: "Pylance"
VS Code version: Code 1.75.0 (e2816fe719a4026ffa1ee0189dc89bdfdbafb164, 2023-02-01T15:29:17.766Z)
OS version: Linux x64 5.15.0-58-generic
Modes:
Sandboxed: No
System Info
| Item | Value |
|---|---|
| CPUs | Intel(R) Core(TM) i5-4570 CPU @ 3.20GHz (4 x 3600) |
| 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_renderer: enabled_on video_decode: disabled_software video_encode: disabled_software vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: disabled_off |
| Load (avg) | 1, 1, 1 |
| Memory (System) | 15.49GB (10.41GB free) |
| Process Argv | . --crash-reporter-id defc98c6-3228-4e0f-9040-d3ced4598bef |
| Screen Reader | no |
| VM | 0% |
| DESKTOP_SESSION | plasma |
| XDG_CURRENT_DESKTOP | KDE |
| XDG_SESSION_DESKTOP | KDE |
| XDG_SESSION_TYPE | x11 |
Extensions (12)
| Extension | Author (truncated) | Version |
|---|---|---|
| prettier-vscode | esb | 9.10.4 |
| vscode-docker | ms- | 1.23.3 |
| isort | ms- | 2022.8.0 |
| python | ms- | 2023.2.0 |
| vscode-pylance | ms- | 2023.2.10 |
| jupyter | ms- | 2023.1.2000312134 |
| jupyter-keymap | ms- | 1.0.0 |
| jupyter-renderers | ms- | 1.0.14 |
| vscode-jupyter-cell-tags | ms- | 0.1.6 |
| vscode-jupyter-slideshow | ms- | 0.1.5 |
| material-icon-theme | PKi | 4.23.1 |
| LiveServer | rit | 5.7.9 |
(3 theme extensions excluded)
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
pythondataviewer:30285071
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593cf:30376535
pythonvs932:30410667
cppdebug:30492333
vscaat:30438848
vsclangdc:30486549
c4g48928:30535728
dsvsc012cf:30540253
azure-dev_surveyone:30548225
vsccc:30610678
pyindex848cf:30577861
nodejswelcome1cf:30587006
3biah626:30602489
f6dab269:30613381
pythonsymbol12cf:30657549
2i9eh265:30646982
Edit (2): Python Show Output
LSP Notebooks experiment is enabled
LSP Notebooks interactive window support is enabled
VS Code was launched from an activated environment: '.venv', selecting it as the interpreter for workspace.
> conda info --json
Python interpreter path: ./.venv/bin/python
> ./.venv/bin/python -I ~/.vscode/extensions/ms-python.python-2023.2.0/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2023.2.0/pythonFiles/interpreterInfo.py
> .venv/bin/python -I ~/.vscode/extensions/ms-python.python-2023.2.0/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2023.2.0/pythonFiles/interpreterInfo.py
> ~/miniconda3/bin/python -I ~/.vscode/extensions/ms-python.python-2023.2.0/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2023.2.0/pythonFiles/interpreterInfo.py
> ~/miniconda3/envs/django-chapter-1/bin/python -I ~/.vscode/extensions/ms-python.python-2023.2.0/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2023.2.0/pythonFiles/interpreterInfo.py
> ~/miniconda3/envs/python310/bin/python -I ~/.vscode/extensions/ms-python.python-2023.2.0/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2023.2.0/pythonFiles/interpreterInfo.py
> /bin/python3 -I ~/.vscode/extensions/ms-python.python-2023.2.0/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2023.2.0/pythonFiles/interpreterInfo.py
> /usr/bin/python3 -I ~/.vscode/extensions/ms-python.python-2023.2.0/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2023.2.0/pythonFiles/interpreterInfo.py
Starting Pylance language server.
Python interpreter path: .venv/bin/python
and these two lines are printed if I manually select recommended interpreter to fix the issue:
Python interpreter path: ./.venv/bin/python
> . ./.venv/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2023.2.0/pythonFiles/printEnvVariables.py
daeh, maurczz, josumoreno-BP, dorian-marchal, jeremymanning and 9 more
Metadata
Metadata
Assignees
Labels
area-environmentsFeatures relating to handling interpreter environmentsFeatures relating to handling interpreter environmentsfeature-requestRequest for new features or functionalityRequest for new features or functionalityneeds community feedbackAwaiting community feedbackAwaiting community feedbackverifiedVerification succeededVerification succeeded
