-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Control pip timeout duration via environment variable #1694
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
Conversation
zanieb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for contributing! I have a couple minor questions.
| match value.parse::<u64>() { | ||
| Ok(parsed) => parsed, | ||
| Err(_) => { | ||
| eprintln!("Warning: UV_REQUEST_TIMEOUT is an invalid value. Using default value."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a warn_user_once! macro that we should use instead here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to use .map_err instead of a match here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd also probably be a little clearer here, maybe:
Ignoring invalid value for UV_REQUEST_TIMEOUT. Expected integer number of seconds, got "{value}".
| } | ||
| Err(_) => default_timeout, | ||
| }; | ||
| debug!("Pip request timeout is {}.", timeout); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably not say "Pip" this is our general registry client
| debug!("Pip request timeout is {}.", timeout); | |
| debug!("Using registry request timeout of {}s", timeout); |
|
@zanieb |
zanieb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
…OUT` (#1780) Follow-up to #1694 matching Cargo's environment variable names https://doc.rust-lang.org/nightly/cargo/reference/config.html#httptimeout
This fixes the following timeout issue when installing PyTorch via uv. Also see reference: astral-sh/uv#1694, astral-sh/uv#1549 ``` Installing pip dependencies Using Python 3.10.16 environment at: /home/yutang/.conda/envs/distribution-myenv × Failed to download and build `antlr4-python3-runtime==4.9.3` ├─▶ Failed to extract archive ├─▶ failed to unpack │ `/home/yutang/.cache/uv/sdists-v7/.tmpDWX4iK/antlr4-python3-runtime-4.9.3/src/antlr4/ListTokenSource.py` ├─▶ failed to unpack │ `antlr4-python3-runtime-4.9.3/src/antlr4/ListTokenSource.py` into │ `/home/yutang/.cache/uv/sdists-v7/.tmpDWX4iK/antlr4-python3-runtime-4.9.3/src/antlr4/ListTokenSource.py` ├─▶ error decoding response body ├─▶ request or response body error ╰─▶ operation timed out help: `antlr4-python3-runtime` (v4.9.3) was included because `torchtune` (v0.5.0) depends on `omegaconf` (v2.3.0) which depends on `antlr4-python3-runtime>=4.9.dev0, <4.10.dev0` Failed to build target distribution-myenv with return code 1 ``` --------- Signed-off-by: Yuan Tang <[email protected]>
Summary
Add the environment variable
UV_REQUEST_TIMEOUTto allow control over pip timeouts.Closes #1549
Test Plan
I built uv in the repository top Dockerfile, set the timeout to 3 seconds, and ran
uv pip install torch.I measured the execution time with the time command and confirmed that the process finished at a value close to the timeout we set.