microsoft / vscode-python

Python extension for Visual Studio Code
https://aka.ms/pvsc-marketplace
MIT License
4.28k stars 1.17k forks source link

Terminal does not automatically choose the environment #23813

Open krigjo25 opened 1 month ago

krigjo25 commented 1 month ago

Type: Bug

The terminal does not automatically choose the python enviornment where to put the pip installation

VS Code version: Code 1.91.1 (f1e16e1e6214d7c44d078b1f0607b2388f29d729, 2024-07-09T22:06:49.809Z) OS version: Windows_NT x64 10.0.19045 Modes:

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz (8 x 3600)| |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
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|undefined| |Memory (System)|31.96GB (21.08GB free)| |Process Argv|--crash-reporter-id 1416d737-f5b1-4bae-94c4-f5be39bf14ca| |Screen Reader|no| |VM|0%|
Extensions (57) Extension|Author (truncated)|Version ---|---|--- python-image-preview|076|0.1.2 vscode-django|bat|1.15.0 kivy-vscode|Bat|0.5.5 django-html|bib|1.3.0 flask-snippets|cst|0.1.3 vscode-mysql-client2|cwe|7.5.5 fivem-lua|dha|1.0.1 vscode-html-css|ecm|2.0.10 syntax-highlighter|evg|0.5.0 pythonsnippets|frh|1.0.2 sql-highlight-insert|Gab|1.0.0 html-preview-vscode|geo|0.2.5 codespaces|Git|1.17.1 gc-excelviewer|Gra|4.2.59 material-kv|had|1.0.0 dotenv|mik|1.0.1 kvlang|Mon|0.0.6 vscode-language-pack-cs|MS-|1.91.2024071009 vscode-language-pack-de|MS-|1.91.2024071009 vscode-language-pack-es|MS-|1.91.2024071009 vscode-language-pack-fr|MS-|1.91.2024071009 vscode-language-pack-it|MS-|1.91.2024071009 vscode-language-pack-ja|MS-|1.91.2024071009 vscode-language-pack-ko|MS-|1.91.2024071009 vscode-language-pack-pl|MS-|1.91.2024071009 vscode-language-pack-pt-BR|MS-|1.91.2024071009 vscode-language-pack-ru|MS-|1.91.2024071009 vscode-language-pack-zh-hans|MS-|1.91.2024071009 vscode-language-pack-zh-hant|MS-|1.91.2024071009 debugpy|ms-|2024.8.0 isort|ms-|2023.10.1 python|ms-|2024.10.0 vscode-pylance|ms-|2024.7.1 jupyter|ms-|2024.6.0 jupyter-keymap|ms-|1.1.2 jupyter-renderers|ms-|1.0.18 vscode-jupyter-powertoys|ms-|0.1.1 vscode-jupyter-slideshow|ms-|0.1.6 cmake-tools|ms-|1.18.43 cpptools|ms-|1.20.5 cpptools-extension-pack|ms-|1.3.0 vsliveshare|ms-|1.0.5932 mysql-shell-for-vs-code|Ora|1.15.1 pawn|Qoo|0.0.3 geo-data-viewer|Ran|2.6.0 LiveServer|rit|5.7.9 preview-vscode|sea|2.3.7 lua|sum|3.9.3 sass-indented|syl|1.8.30 local-lua-debugger-vscode|tom|0.3.3 pdf|tom|1.2.2 python-extended-snippets|tus|0.0.1 cmake|twx|0.0.17 html-preview|ty4|1.4.0 kivy-snippets|wat|1.0.3 html-snippets|wsc|1.0.6 html-css-class-completion|Zig|1.20.0 (1 theme extensions excluded)
A/B Experiments ``` vsliv368:30146709 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscod805:30301674 binariesv615:30325510 vsaa593:30376534 py29gd2263:31024239 vscaac:30438847 c4g48928:30535728 azure-dev_surveyone:30548225 962ge761:30959799 pythongtdpath:30769146 welcomedialog:30910333 pythonnoceb:30805159 asynctok:30898717 pythonregdiag2:30936856 pythonmypyd1:30879173 2e7ec940:31000449 pythontbext0:30879054 accentitlementst:30995554 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 chatpanelc:31048052 dsvsc021:30996838 9c06g630:31013171 pythoncenvpt:31062603 a69g1124:31058053 dvdeprecation:31068756 dwnewjupyter:31046869 legacy_priority:31094926 0c838689:31092287 ```
karthiknadig commented 1 month ago

Can you explain what you mean? If you are using a virtual environment then the python in the terminal will be the python from the virtual environment. If you are using global environments, then the python will be based on what is set by your PATH environment variable.

krigjo25 commented 1 month ago

Well I was expecting at last the internal terminal would point to the internal virtual environment as I did get the prompt "(.venv) D://Projects/python", but even when the venv was pointed manually it didn't work at all. I didn't touch any system environments either. But it could be a windows glitch, also, as I re created the environment and re-installed Visual studio Code the issue were solved.

So I'm not sure how to reproduce the bug unless installing python after codevs and environment creation.