Skip to content

ci: configure tox to pass environment variables for PyTorch#1411

Merged
mrariden merged 2 commits intoMouseLand:mainfrom
qin-yu:qy/fix-ci
Mar 2, 2026
Merged

ci: configure tox to pass environment variables for PyTorch#1411
mrariden merged 2 commits intoMouseLand:mainfrom
qin-yu:qy/fix-ci

Conversation

@qin-yu
Copy link
Contributor

@qin-yu qin-yu commented Feb 25, 2026

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 USERNAME by default. When importing, PyTorch’s torch._inductor calls getpass.getuser() to determine its cache directory. Without USERNAME, it falls back to importing pwd, 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_DIR explicitly 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).

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.
@qin-yu
Copy link
Contributor Author

qin-yu commented Feb 25, 2026

macOS failed once (maybe) due to pytorch/pytorch/issues/44282

@codecov
Copy link

codecov bot commented Feb 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 41.64%. Comparing base (8b3930e) to head (26c0255).
⚠️ Report is 23 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Removed unnecessary environment variables from tox.ini.
@mrariden
Copy link
Collaborator

mrariden commented Mar 2, 2026

Thanks @qin-yu this is a very helpful solution to a very annoying problem

@mrariden mrariden merged commit 4fa1e24 into MouseLand:main Mar 2, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants