microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.27k stars 28.57k forks source link

Selecting venv python interpreter uses wrong python version #208139

Closed st0w closed 5 months ago

st0w commented 5 months ago

Type: Bug

Behaviour

Expected vs. Actual

Expected:

Actual:

Warnings are generated for missing modules (which are not missing when the script is run), and context-sensitive help is not available.

Steps to reproduce:

  1. Previously create a venv using python -mvenv venv and install some modules into it using pip
  2. Follow the isntructions for "Manually specify an interpreter" on https://code.visualstudio.com/docs/python/environments#_working-with-python-interpreters
  3. Use the file browser to select the python file at venv/bin/python

Diagnostic data

User Settings

``` languageServer: "Pylance" ```

VS Code version: Code 1.87.2 (863d2581ecda6849923a2118d93a088b0745d9d6, 2024-03-08T15:20:57.520Z) OS version: Darwin arm64 22.4.0 Modes:

System Info |Item|Value| |---|---| |CPUs|Apple M1 (8 x 24)| |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, 2, 2| |Memory (System)|16.00GB (0.06GB free)| |Process Argv|| |Screen Reader|no| |VM|0%|
Extensions (25) Extension|Author (truncated)|Version ---|---|--- dbclient-jdbc|cwe|1.3.4 vscode-postgresql-client2|cwe|7.1.1 vscode-eslint|dba|2.4.4 es7-react-js-snippets|dsz|4.4.3 gitlens|eam|14.9.0 vscode-html-css|ecm|2.0.9 EditorConfig|Edi|0.16.4 prettier-vscode|esb|10.1.0 vscode-graphql|Gra|0.9.3 vscode-graphql-syntax|Gra|1.3.5 vscode-language-babel|mgm|0.0.40 debugpy|ms-|2024.2.0 pylint|ms-|2023.10.1 python|ms-|2024.2.1 vscode-pylance|ms-|2024.3.1 jupyter|ms-|2024.2.0 jupyter-keymap|ms-|1.1.2 jupyter-renderers|ms-|1.0.17 vscode-jupyter-cell-tags|ms-|0.1.8 vscode-jupyter-slideshow|ms-|0.1.5 react-proptypes-intellisense|OfH|1.0.3 vscode-versionlens|pfl|1.9.2 heroku-command|pko|0.0.8 prisma|Pri|5.11.0 vscode-import-cost|wix|3.3.0 (1 theme extensions excluded)
karrtikr commented 5 months ago

Closing as dup of https://github.com/microsoft/vscode-python/issues/13603#issuecomment-1010450426