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

Interpreter discovery times out on first load #24226

Open
mnoah1 opened this issue Oct 2, 2024 · 6 comments
Open

Interpreter discovery times out on first load #24226

mnoah1 opened this issue Oct 2, 2024 · 6 comments
Assignees
Labels
feature-request Request for new features or functionality triage-needed Needs assignment to the proper sub-team

Comments

@mnoah1
Copy link

mnoah1 commented Oct 2, 2024

In our monorepo (which uses Python + Bazel), we have a setup where the very first python run in the repo can take longer to complete (there is some additional work like building generating dependencies and setting up the venv going on). As a result, the interpreter info script fails to complete in time on this initial run.

It appears there is a hard coded 15 seconds in place for this step - we would like to make this configurable so that it waits long enough for this to complete and users don't get an error in this scenario.

@mnoah1 mnoah1 added the feature-request Request for new features or functionality label Oct 2, 2024
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Oct 2, 2024
@karthiknadig
Copy link
Member

Can you provide some details on the very first run of python? Is it that we select the venv the moment it gets created and then it fails? Can you provide details on the failure?

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Oct 2, 2024
@karthiknadig karthiknadig self-assigned this Oct 3, 2024
@mnoah1
Copy link
Author

mnoah1 commented Oct 3, 2024

Can you provide some details on the very first run of python?

With Bazel, the first run also has to populate the Bazel cache (e.g. including downloading external dependencies and creating any generated files), then creates the venv and symlinks to the python interpreter inside the cache. After that python can actually run.

Can you provide details on the failure?

Once the run takes longer than the 15 second timeout (the line I edited in the PR mentioned above), the process gets killed and interpreter discovery fails or may search the system for other possible interpreters and select the wrong one. If it weren't for the timeout, it would succeed.

Given this, and the fact that this setup likely only affects a small subset of users, I suggest a configuration option that would allow this timeout to be extended if a repo's setup warrants it.

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Oct 3, 2024
@karthiknadig
Copy link
Member

Would it be enough if this timeout was set via an environment variable?

We are working on changing the python discovery process. Making it reliable and extensible. We would like to avoid adding any settings that we may need to take out as a part of the process. The work that we are doing would allow you to contribute a custom environment manager (creator, selector, etc), so you can control that experience.

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Oct 3, 2024
@mnoah1
Copy link
Author

mnoah1 commented Oct 4, 2024

Yes, that will work too. Do you just mean an environment variable via the extension's process.env?

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Oct 4, 2024
@karthiknadig
Copy link
Member

Yes. process.env.

@mnoah1
Copy link
Author

mnoah1 commented Oct 7, 2024

Hi @karthiknadig - I went ahead and updated #24227 to support this. Can you take a look?

karthiknadig pushed a commit that referenced this issue Oct 7, 2024
Addressing issue #24226

This adds a way to customize the timeout for the interpreter info script
to run, by customizing the duration of the
`VSC_PYTHON_INTERPRETER_INFO_TIMEOUT` environment variable.

This is to address setups (e.g. a monorepo with Bazel) where the hard
coded 15 seconds is insufficient, as the first Python run also includes
additional setup work to ensure the venv is available for use before the
interpreter can actually execute.

This is being done via env var instead of via a VS Code setting to avoid
introducing additional settings that will be deprecated after other
planned upcoming work on interpreter discovery (see discussion on
24226).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

2 participants