-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Comments
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? |
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.
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. |
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. |
Yes, that will work too. Do you just mean an environment variable via the extension's process.env? |
Yes. |
Hi @karthiknadig - I went ahead and updated #24227 to support this. Can you take a look? |
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).
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.
The text was updated successfully, but these errors were encountered: