From c16f37d89daa83dce20cd04a7f82a4c62ca0639d Mon Sep 17 00:00:00 2001 From: jax authors Date: Wed, 5 Mar 2025 18:08:35 -0800 Subject: [PATCH] Set `USERPROFILE` for Windows builds to fix CI issue. This change fixes https://github.com/jax-ml/jax/actions/runs/13686468791/job/38270929632. From the [documentation](https://docs.python.org/3/library/os.path.html#os.path.expanduser): `On Windows, USERPROFILE will be used if set, otherwise a combination of HOMEPATH and HOMEDRIVE will be used.` PiperOrigin-RevId: 733935305 --- jaxlib/tools/build_utils.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/jaxlib/tools/build_utils.py b/jaxlib/tools/build_utils.py index 9c7f61fc2..4c50cff16 100644 --- a/jaxlib/tools/build_utils.py +++ b/jaxlib/tools/build_utils.py @@ -70,6 +70,12 @@ def build_wheel( env = dict(os.environ) if git_hash: env["JAX_GIT_HASH"] = git_hash + if is_windows() and ( + "USERPROFILE" not in env + and "HOMEDRIVE" not in env + and "HOMEPATH" not in env + ): + env["USERPROFILE"] = env.get("SYSTEMDRIVE", "C:") subprocess.run( [sys.executable, "-m", "build", "-n"] + (["-w"] if build_wheel_only else []),