ci: configure tox to pass environment variables for PyTorch#1411
Merged
mrariden merged 2 commits intoMouseLand:mainfrom Mar 2, 2026
Merged
ci: configure tox to pass environment variables for PyTorch#1411mrariden merged 2 commits intoMouseLand:mainfrom
mrariden merged 2 commits intoMouseLand:mainfrom
Conversation
tox's isolated environment blocks `USERNAME` by default, causing PyTorch's `torch._inductor` to fail during import when it calls `getpass.getuser()` for cache directory setup. Pass through username and temp directory variables, and set `TORCHINDUCTOR_CACHE_DIR` explicitly to avoid the getpass call. Fixes Windows Python 3.10/3.11 test failures.
Contributor
Author
|
macOS failed once (maybe) due to pytorch/pytorch/issues/44282 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1411 +/- ##
==========================================
- Coverage 42.39% 41.64% -0.76%
==========================================
Files 16 16
Lines 3781 3756 -25
==========================================
- Hits 1603 1564 -39
- Misses 2178 2192 +14 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Removed unnecessary environment variables from tox.ini.
Collaborator
|
Thanks @qin-yu this is a very helpful solution to a very annoying problem |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi @mrariden, I noticed that recent PRs, including mine (#1410), have been failing on the Windows CI job.
The root cause is that tox’s isolated environment does not pass
USERNAMEby default. When importing, PyTorch’storch._inductorcallsgetpass.getuser()to determine its cache directory. WithoutUSERNAME, it falls back to importingpwd, which is not available on Windows, causing the tests to fail during collection.This PR passes the relevant username and temp environment variables through tox and sets
TORCHINDUCTOR_CACHE_DIRexplicitly to a writable location.This resolves the Windows Python 3.10/3.11 CI failures affecting:
The macOS failure observed in the first CI run appears unrelated to this change and may be similar to the native abort seen in #1381, potentially related to upstream PyTorch behavior (e.g. pytorch/pytorch/issues/44282).