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

Visual Code doesn't seem to re-trigger if a virtual environment is deleted. #18009

Closed
1 task done
kayhayen opened this issue Nov 11, 2021 · 4 comments
Closed
1 task done
Assignees
Labels
area-environments Features relating to handling interpreter environments bug Issue identified by VS Code Team member as probable bug investigating We are looking into the cause of the issue

Comments

@kayhayen
Copy link

VS Code version

Version: 1.62.1 (user setup) Commit: f4af3cbf5a99787542e2a30fe1fd37cd644cc31f Date: 2021-11-05T10:57:55.946Z Electron: 13.5.2 Chrome: 91.0.4472.164 Node.js: 14.16.0 V8: 9.1.269.39-electron.0 OS: Windows_NT x64 10.0.19043

Extension version

v2021.11.1422169775

OS type

Linux

OS version

Debian Buster WSL

Python distribution

Other

Python version

3.9

Language server

Pylance

Expected behaviour

When I deleted a virtualenv with python3.9 pipenv --rm it becomes unusable with it. However, in Visual Code, I couldn't get rid of it. I expected it to cease using it, after it became unusable to pipenv.

Actual behaviour

Visual Code never ceased to use it, and it never offered me to select the new environment created in the same place, but with a different version. I verified that pipenv was using for that folder this pipenv, but Visual Code was not. Somehow pipenv environment retains information about the old environment.

I deleted .vscode-server with no success. I think found that if I delete .local/share/virtualenvs/<name_of_the_folder_as_seen_in_vscode> the information is gone.

Not sure what's going on here, clearly pipenv --rm didn't do its job properly, but also Visual Code doesn't detect the multiple Python versions used in that folder, and should have listed both, but it only listed one of them.

Steps to reproduce

python3.7 -m pipenv install with any environment, then open the folder in Visual Code. python3.7 pipenv --rm and then it is still present, and the one created with python3.9 -m pipenv install never shows up.

Logs

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@kayhayen kayhayen added bug Issue identified by VS Code Team member as probable bug triage-needed Needs assignment to the proper sub-team labels Nov 11, 2021
@karthiknadig
Copy link
Member

@kayhayen We don't watch the pipenv environment location for performance reasons. You can force an cache cleanup using Python: Clear Internal Extension Cache command. That should cause new environments to discovered when you try to select environments.

@kayhayen
Copy link
Author

That command was executed by me, and then it says "Discovering Python interpreters" when I reload the Window, but the pipenv created virtual is not picked up again ever. I do not understand how it ever became an option in the first place. So checked Python debug log, and it has this:

Part of the issue might be this:

~/.local/share/virtualenvs/Nuitka-website-0HXc3EPR/bin/python ~/.vscode-server/extensions/ms-python.python-2021.11.1422169775/pythonFiles/interpreterInfo.py
/home/hayen/.local/share/virtualenvs/Nuitka-website-0HXc3EPR/bin/python: error while loading shared libraries: libpython3.9.so.1.0: cannot open shared object file: No such file or directory

The Python I used before, was the Debian Python, and it's a self compiled one now, and I have had problems with virtualenvs before with them. I am to blame for having this:

cat /usr/bin/python3.9
#!/bin/sh
LD_LIBRARY_PATH=/opt/python395/lib exec /opt/python395/bin/python3.9 "$@"

Virtualenvs create a python binary without LD_LIBRARY_PATH set. I am to blame for that of course. Not sure now how valid my original report is now. I will make my Python install saner and report if that helps in the first place, it very well might do so. But if it does not, just a small comment from me as a user. The thing that turned me on about Visual Code when I first used it, was that all information was updated live as I edited. It would be desirable to at least do such a scan at startup, having to find this command (which I search for, but I was looking at "virtualenv" in search box, is unlikely to succeed.

@karthiknadig karthiknadig added area-environments Features relating to handling interpreter environments triage and removed triage-needed Needs assignment to the proper sub-team labels Nov 15, 2021
@karrtikr karrtikr added investigating We are looking into the cause of the issue and removed triage labels Nov 15, 2021
@karrtikr
Copy link

That command was executed by me, and then it says "Discovering Python interpreters" when I reload the Window, but the pipenv created virtual is not picked up again ever. I do not understand how it ever became an option in the first place. So checked Python debug log, and it has this:

I have opened #18209 in case us pointing you to the logs might have helped you discover the issue faster. Please upvote if that helps.

@karrtikr
Copy link

karrtikr commented Dec 21, 2021

Regarding the autoupdating of version information, #18009 (comment) provides the explanation.

The thing that turned me on about Visual Code when I first used it, was that all information was updated live as I edited. It would be desirable to at least do such a scan at startup, having to find this command

We try our best to do that, but in this case we cache the version info for the current session for performance reasons, so a simple reload should update the version. (using Developer: Reload Window command)

Let me know if you have any other feedback.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-environments Features relating to handling interpreter environments bug Issue identified by VS Code Team member as probable bug investigating We are looking into the cause of the issue
Projects
None yet
Development

No branches or pull requests

3 participants