Skip to content

Commit 50ca6e9

Browse files
authored
Merge pull request #647 from unilabsim/fix/aarch64-mujoco-uni-deps
fix: support linux aarch64 dependencies
2 parents c1e9e9b + 37b09eb commit 50ca6e9

3 files changed

Lines changed: 482 additions & 394 deletions

File tree

pyproject.toml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ license-files = ["LICENSE"]
1212
requires-python = ">=3.10,<3.14"
1313
dependencies = [
1414
"numpy",
15-
"torch==2.7.0",
15+
"torch==2.9.0 ; sys_platform == 'linux' and platform_machine == 'aarch64'",
16+
"torch==2.7.0 ; sys_platform != 'linux' or platform_machine != 'aarch64'",
1617
"gymnasium",
1718
"imageio",
1819
"etils",
@@ -61,16 +62,24 @@ name = "pytorch-cu128"
6162
url = "https://download.pytorch.org/whl/cu128"
6263
explicit = true
6364

65+
[[tool.uv.index]]
66+
name = "r2-cu130"
67+
url = "https://download-r2.pytorch.org/whl/cu130"
68+
explicit = true
69+
6470
[tool.uv.sources]
6571
torch = [
66-
{ index = "pytorch-cu128", marker = "sys_platform=='linux' or sys_platform=='win32'" },
72+
{ index = "r2-cu130", marker = "sys_platform=='linux' and platform_machine=='aarch64'" },
73+
{ index = "pytorch-cu128", marker = "sys_platform=='linux' and platform_machine=='x86_64'" },
74+
{ index = "pytorch-cu128", marker = "sys_platform=='win32'" },
6775
]
6876

6977
[tool.uv]
7078
exclude-dependencies = ["torchvision"]
7179
required-environments = [
7280
"sys_platform == 'darwin' and platform_machine == 'arm64'",
7381
"sys_platform == 'linux' and platform_machine == 'x86_64'",
82+
"sys_platform == 'linux' and platform_machine == 'aarch64'",
7483
]
7584

7685
[tool.ruff]

tests/scripts/test_torch_cuda_source.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,15 @@ def test_torch_cuda_source_covers_windows_and_linux() -> None:
1111

1212
torch_sources = data["tool"]["uv"]["sources"]["torch"]
1313
cu128_sources = [source for source in torch_sources if source.get("index") == "pytorch-cu128"]
14+
cu130_sources = [source for source in torch_sources if source.get("index") == "r2-cu130"]
1415

15-
assert len(cu128_sources) == 1
16-
marker = cu128_sources[0]["marker"]
17-
assert "sys_platform=='linux'" in marker
18-
assert "sys_platform=='win32'" in marker
16+
assert {source["marker"] for source in cu128_sources} == {
17+
"sys_platform=='linux' and platform_machine=='x86_64'",
18+
"sys_platform=='win32'",
19+
}
20+
assert [source["marker"] for source in cu130_sources] == [
21+
"sys_platform=='linux' and platform_machine=='aarch64'"
22+
]
1923

2024

2125
def test_windows_lock_uses_cuda_torch() -> None:
@@ -29,7 +33,13 @@ def test_windows_lock_uses_cuda_torch() -> None:
2933
"name": "torch",
3034
"version": "2.7.0+cu128",
3135
"source": {"registry": "https://download.pytorch.org/whl/cu128"},
32-
"marker": "sys_platform == 'linux' or sys_platform == 'win32'",
36+
"marker": "(platform_machine == 'x86_64' and sys_platform == 'linux') or sys_platform == 'win32'",
37+
} in torch_dependencies
38+
assert {
39+
"name": "torch",
40+
"version": "2.9.0+cu130",
41+
"source": {"registry": "https://download-r2.pytorch.org/whl/cu130"},
42+
"marker": "platform_machine == 'aarch64' and sys_platform == 'linux'",
3343
} in torch_dependencies
3444

3545
torch_packages = [package for package in lock["package"] if package["name"] == "torch"]

0 commit comments

Comments
 (0)