Skip to content

Discovery runs conda info command multiple times during startup when large number of conda interpreters are present #18200

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

Closed
1 task done
wubdub opened this issue Dec 16, 2021 · 37 comments · Fixed by #18808
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 verified Verification succeeded
Milestone

Comments

@wubdub
Copy link

wubdub commented Dec 16, 2021

VS Code version

1.63.0

Extension version

v2021.12.1559732655

OS type

macOS

OS version

11.4

Python distribution

Anaconda

Python version

3.8.5

Language server

Default

Expected behaviour

I would expect the extension to just use the already selected Python interpreter on the left and provide indexer features (like the ability to click through functions) on startup.
Screen Shot 2021-12-16 at 11 09 31 AM

Actual behaviour

The "Discovering Python Interpreters" dialog spins forever. If I go to "Output" and then select "Python" on the right drop down, the issue is the extension is looping through hundreds of python versions available on the cluster I am ssh'ing into.

For example, I see a constant output of the format, for everyone of hundreds of conda envs. I would just like to skip this discovering step and use the one I already selected.

> /home/XXX/.conda/envs/1e59305f3-855/bin/python ~/.vscode-server/extensions/ms-python.python-2021.12.1559732655/pythonFiles/interpreterInfo.py
> conda info --json

Steps to reproduce

Have many python versions available in your conda env.

Logs

No response

Code of Conduct

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

provide indexer features (like the ability to click through functions) on startup.

Is Discovery Interpreters somehow hindering this or your work?

@brettcannon brettcannon added info-needed Issue requires more information from poster triage labels Dec 20, 2021
@brettcannon brettcannon added area-environments Features relating to handling interpreter environments and removed triage-needed Needs assignment to the proper sub-team labels Dec 20, 2021
@brettcannon
Copy link
Member

Was the environment previously selected for the workspace or was the terminal you launched VS Code from already activated? Or did you open a workspace with no environment selected and then you chose it (i.e. some form of discovery would have been required to find the environment regardless)?

@wubdub
Copy link
Author

wubdub commented Jan 4, 2022

Is Discovery Interpreters somehow hindering this or your work?

Yes, during this time that "Discovering Python Interpreters" message is present the indexer does not work so I can't click on variables, click to go to function definitions, etc.

@brettcannon, I set the "Default Interpreter Path" through this setting:
Screen Shot 2022-01-04 at 9 35 58 AM

To summarize, if "Default Interpreter Path" is set, I would expect "Discovering Python Interpreters" not to have run, which would then allow features related to the indexer to work instantly

@karrtikr karrtikr added investigating We are looking into the cause of the issue and removed info-needed Issue requires more information from poster triage labels Jan 5, 2022
@karrtikr
Copy link

karrtikr commented Jan 5, 2022

Yes, during this time that "Discovering Python Interpreters" message is present the indexer does not work so I can't click on variables, click to go to function definitions, etc.

I see, can you provide me the logs as mentioned in the issue template during the message is present? I'm interested in the commands extension runs which particularly slows things down for you.

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

XXX

Also, how long does 'conda info --json' command takes when run in terminal?

@karrtikr karrtikr added the info-needed Issue requires more information from poster label Jan 5, 2022
@wubdub
Copy link
Author

wubdub commented Jan 5, 2022

Thanks @karrtikr!

log.txt attached, it looks like it fails to do something in the beginning and then starts stepping through every single conda environment in /ZZZ/shared/conda-envs/

The conda info call on the command line is very fast

$ time conda info --json 

real	0m6.149s
user	0m0.258s
sys	0m0.109s

@karrtikr karrtikr removed the info-needed Issue requires more information from poster label Jan 5, 2022
@ghost
Copy link

ghost commented Jan 13, 2022

Same problem here :(

@karrtikr
Copy link

@wubdub Please try the following VSIX https://github.com/microsoft/vscode-python/suites/4975845256/artifacts/145186523 and let me know if it helps: Use Extension: Install from VSIX... command to install the VSIX.

@karrtikr karrtikr added the info-needed Issue requires more information from poster label Jan 18, 2022
@wubdub
Copy link
Author

wubdub commented Jan 27, 2022

@karrtikr thanks! I get a "Failed to generate URL to download artifact" message, perhaps it has expired?

@karrtikr karrtikr removed the info-needed Issue requires more information from poster label Jan 28, 2022
@brettcannon
Copy link
Member

@wubdub yep, we only keep GitHub Actions artifacts around for a week.

@karrtikr was that to a build from a PR or latest insiders?

@karrtikr
Copy link

It was a build off this PR #18309, will rebuild and post the new artifact soon.

@karrtikr
Copy link

@wubdub Here: https://github.com/microsoft/vscode-python/suites/5100759928/artifacts/152543360

@wubdub
Copy link
Author

wubdub commented Jan 28, 2022

@karrtikr it seems a bit faster now thanks, still takes about 10 mins to load each time I start VSCode, not sure if there is any other low hanging fruit. Attaching log2.txt

@karrtikr
Copy link

karrtikr commented Jan 28, 2022

I'm not sure why it would take 10 mins given your log, it seems conda info --json is run repeatedly, can you add python.logging.level to debug in User settings, reload window and provide me the logs again. Use the following VSIX: https://github.com/microsoft/vscode-python/suites/5101823480/artifacts/152602533

@karrtikr karrtikr added the info-needed Issue requires more information from poster label Jan 28, 2022
@karrtikr
Copy link

Also, try the following VSIX where we do not trigger discovery at all: https://github.com/microsoft/vscode-python/suites/5101652551/artifacts/152593035

@karrtikr
Copy link

karrtikr commented Mar 9, 2022

Ping @wubdub

@karrtikr
Copy link

karrtikr commented Mar 9, 2022

Also see #18647 for the feature request you asked for.

@karrtikr karrtikr added feature-request Request for new features or functionality needs PR info-needed Issue requires more information from poster and removed bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster investigating We are looking into the cause of the issue labels Mar 9, 2022
@wubdub
Copy link
Author

wubdub commented Mar 9, 2022

Ping @wubdub

Sorry for the delay, attached!
debug.txt

Also, within those 5 minutes, are you still blocked and cannot use other extension features?

Yes I cannot click through functions, etc. during this time

@karrtikr karrtikr removed the info-needed Issue requires more information from poster label Mar 10, 2022
@karrtikr
Copy link

karrtikr commented Mar 10, 2022

Thanks and here is the final VSIX I have for you: https://github.com/microsoft/vscode-python/suites/5609518918/artifacts/182361458

Yes I cannot click through functions, etc. during this time

Looking at the logs I noticed that the language server (Pylance) responsible for providing these features was not started until discovery was finished (created #18671). So in the VSIX above I ensure Pylance is started first, and discovery is triggered afterwards.

Let me know how long does it take here to unblock you for using the above features. Also please provide the logs.

@wubdub
Copy link
Author

wubdub commented Mar 10, 2022

Let me know how long does it take here to unblock you for using the above features. Also please provide the logs.

Awesome!! The Pylance features are now nearly instantly available, works great!
debug.txt

@karrtikr karrtikr removed the info-needed Issue requires more information from poster label Mar 10, 2022
@karrtikr
Copy link

karrtikr commented Mar 10, 2022

Fantastic 🥳 thanks for your help. We'll fix it soon with #18671, I'll fix the bug discovered here #18200 (comment) with this issue.

@karrtikr karrtikr changed the title "Discovering Python Interpreters" runs through 100s of conda python versions every single time "Discovering Python Interpreters" runs conda info command multiple times during startup when large number of conda interpreters are present Mar 22, 2022
@karrtikr karrtikr changed the title "Discovering Python Interpreters" runs conda info command multiple times during startup when large number of conda interpreters are present Discovery runs conda info command multiple times during startup when large number of conda interpreters are present Mar 22, 2022
@karrtikr karrtikr added bug Issue identified by VS Code Team member as probable bug and removed feature-request Request for new features or functionality labels Mar 29, 2022
@karrtikr karrtikr added this to the April 2022 milestone Mar 29, 2022
@karrtikr karrtikr added the verified Verification succeeded label Mar 29, 2022
@kosarkazemi
Copy link

Hello,
I am having this issue.
What should I update?
The page: https://github.com/microsoft/vscode-python/suites/5100759928/artifacts/152543360 is out of access now.

@karrtikr
Copy link

The fix is out in the latest stable release, so simply updating to the latest version of VSCode and extension should ideally fix it.

@wubdub
Copy link
Author

wubdub commented Apr 13, 2022

@karrtikr I am actually running v2022.4.1 but the "Discovering Python Interpreters" continues to spin for a long time, printing out <various environment path>/bin/python ~/.vscode-server/extensions/ms-python.python-2022.4.1/pythonFiles/get_output_via_markers.py ~/.vscode-server/extensions/ms-python.python-2022.4.1/pythonFiles/interpreterInfo.py - perhaps this is a new issue I should file a ticket for?

@karrtikr
Copy link

karrtikr commented Apr 13, 2022

This only fixes the issue that conda info command is only run once during startup. So discovery may still take longer and we may run interpreterInfo.py scripts but that is to be expected. Just make sure the same command isn't run twice.

Thank you, just ran it, seemed to take about 5+ mins to load still

Stable VSIX should bring you to this state you mentioned above.

The fact that language server isn't started will be fixed by #18671.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 14, 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 verified Verification succeeded
Projects
None yet
4 participants