Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In-project virtualenv not available when added to .gitignore #21855

Closed
th0ger opened this issue Aug 20, 2023 · 7 comments
Closed

In-project virtualenv not available when added to .gitignore #21855

th0ger opened this issue Aug 20, 2023 · 7 comments
Assignees
Labels
triage-needed Needs assignment to the proper sub-team

Comments

@th0ger
Copy link

th0ger commented Aug 20, 2023

Type: Bug

Behaviour

Expected vs. Actual

I use in-project Poetry virtual environment stored in .venv/. The venv loads fine automatically in VSCode.

But if I add .venv/ to .gitignore and restart VSCode, then the venv doesn't load. (It load the system python interpreter instead).
The in-project venv is also no longer available from the "Python: Select Interpreter".

Steps to reproduce:

$ poetry config --list | grep virtualenvs.in-project
virtualenvs.in-project = true

$ poetry init
...
[tool.poetry]
name = "debug_my_venv"
version = "0.1.0"
description = ""
authors = ["..."]
readme = "README.md"
packages = [{include = "debug_my_venv"}]

[tool.poetry.dependencies]
python = "^3.11"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

$ poetry shell
$ poetry install
(.venv/ generated)
$ echo ".venv/" > .gitignore
$ touch foo.py
$ code .

Diagnostic data

  • Python version (& distribution if applicable, e.g. Anaconda): 3.11.4
  • Type of virtual environment used: Global / Poetry (depending on .gitignore...)
  • Value of the python.languageServer setting: Default
Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

None

User Settings


languageServer: "Pylance"

Extension version: 2023.14.0
VS Code version: Code 1.81.1 (6c3e3dba23e8fadc360aed75ce363ba185c49794, 2023-08-09T22:22:42.175Z)
OS version: Windows_NT x64 10.0.19045
Modes:
Remote OS version: Linux x64 5.15.90.1-microsoft-standard-WSL2
Remote OS version: Linux x64 5.15.90.1-microsoft-standard-WSL2

System Info
Item Value
CPUs Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz (12 x 2592)
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
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) undefined
Memory (System) 31.79GB (7.18GB free)
Process Argv REDACTED
Screen Reader no
VM 0%
Item Value
Remote WSL: Ubuntu-20.04
OS Linux x64 5.15.90.1-microsoft-standard-WSL2
CPUs Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz (12 x 2592)
Memory (System) 15.62GB (12.93GB free)
VM 0%
Item Value
Remote WSL: Ubuntu-20.04
OS Linux x64 5.15.90.1-microsoft-standard-WSL2
CPUs Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz (12 x 2592)
Memory (System) 15.62GB (12.93GB free)
VM 0%
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vstes627cf:30244335
vslsvsres303:30308271
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vsdfh931:30280409
vshan820:30294714
vstes263:30335439
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
pythonvs932:30410667
vsclangdf:30486550
c4g48928:30535728
dsvsc012cf:30540253
pynewext54:30695312
azure-dev_surveyone:30548225
vscccc:30803845
282f8724:30602487
89544117:30613380
2i9eh265:30646982
showlangstatbar:30737416
03d35959:30757346
pythonfmttext:30731395
pythoncmvfstrcf:30756944
fixshowwlkth:30771522
showindicator:30805244
pythongtdpath:30769146
i26e3531:30792625
gsofa:30804715
pythonnosmt12:30797651
pythonidxpt:30805730
pythonnoceb:30805159
dsvsc013:30795093
dsvsc014:30804076
diffeditorv2:30812749

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Aug 20, 2023
@karrtikr
Copy link

That's interesting, thanks for letting us know about this. We'll try to reproduce this behavior and get back to you soon.

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Aug 21, 2023
@karrtikr karrtikr removed the info-needed Issue requires more information from poster label Aug 21, 2023
@karrtikr
Copy link

karrtikr commented Sep 6, 2023

@th0ger Unfortunately I'm unable to repro this, but it could due to the fact that we recently fixed discovering venv correctly #21862 in remote scenarios. Can you try VS Code Insiders with pre-release version of the extension and see if it helps?

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Sep 6, 2023
@karrtikr
Copy link

karrtikr commented Sep 6, 2023

image

VS Code Insiders: https://code.visualstudio.com/insiders/

@th0ger
Copy link
Author

th0ger commented Sep 6, 2023

@karrtikr which version did you use for testing?

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Sep 6, 2023
@karrtikr
Copy link

karrtikr commented Sep 6, 2023

Try the latest pre-release version for VS Code Insiders

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Sep 6, 2023
@th0ger
Copy link
Author

th0ger commented Sep 8, 2023

I'm no longer able to repro on vscode ver 1.81.1...
That 's odd, because I reproduced it 3-4 times with above steps before I filed this issue.

@th0ger th0ger closed this as completed Sep 8, 2023
@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Sep 8, 2023
@karrtikr
Copy link

karrtikr commented Sep 8, 2023

Good to know, We just made a new VS Code release which likely has something to do with it

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

2 participants