Skip to content

Fix dependency resolution on macOS / Apple Silicon - #298

Open
medyadanhasan wants to merge 1 commit into
Lightricks:mainfrom
medyadanhasan:macos-arm64-install-fix
Open

medyadanhasan wants to merge 1 commit into
Lightricks:mainfrom
medyadanhasan:macos-arm64-install-fix

Conversation

@medyadanhasan

Copy link
Copy Markdown

What

uv sync fails on darwin-arm64 before a single package is installed:

error: Distribution `torch==2.13.0+cu132 @ registry+https://download.pytorch.org/whl/cu132`
can't be installed because it doesn't have a source distribution or wheel for the current platform

Three unconditional CUDA-only pins cause it:

  • packages/ltx-core/pyproject.toml points torch / torchaudio at the cu132 indexes. Those indexes ship no darwin wheels for any version, so no torch can ever resolve on macOS.
  • packages/ltx-trainer/pyproject.toml does the same for torchcodec / torchaudio.
  • The root override-dependencies entry for nvidia-cudnn-cu13 carries no marker, so the CUDA-only cuDNN wheel is forced onto macOS as well.

This PR attaches sys_platform != 'darwin' markers to the index sources, letting macOS fall back to PyPI where the MPS-enabled wheels live, and scopes the cuDNN override to Linux.

Why

The repo already treats Apple Silicon as a supported target: ltx-core declares mps-sdpa for sys_platform == 'darwin' and platform_machine == 'arm64' (with a comment noting it is "the only viable attention kernel" there), ltx_core/devices.py resolves and returns torch.device("mps"), attention.py selects an MPS-SDPA backend, and the README states the natten extra is skipped automatically on macOS so "the same command works everywhere". Today that path is unreachable — dependency resolution fails first.

Impact on other platforms

None. Linux and Windows keep resolving torch, torchaudio and torchcodec from the same CUDA indexes as before, and keep the nvidia-cudnn-cu13 override. The markers only add a fallback where the pinned indexes have nothing to offer.

Verification

On macOS 26 / Apple M5 Max (36 GB), Python 3.14:

  • uv sync --package ltx-pipelines installs torch 2.13.0 and torchaudio 2.11.0 from PyPI; torch.backends.mps.is_available() is True; mps-sdpa installs as intended.
  • python -m ltx_pipelines.distilled --help runs.
  • Real generation works end to end with the LTX-2.3 monolith checkpoint (43 GB) plus Gemma 3 12B, using --offload disk: transformer builds with "attention backends -- self: MPS-SDPA, masked: MPS-SDPA", and 1024x576 and 1920x1088 clips with synchronized audio were produced successfully.

Note for reviewers, unrelated to this diff

--quantization fp8-cast cannot work on MPS: _upcast_and_round in ltx_core/quantization/fp8_cast.py raises RuntimeError: Undefined type Float8_e4m3fn, since the MPS backend has no fp8 dtype. Apple Silicon users' only memory levers are --offload cpu / --offload disk and resolution. A clearer up-front error (or a doc line) would save people a 43 GB load before the failure. Happy to open a separate issue or PR for that if useful.

`uv sync` fails on darwin-arm64 before any package is installed:

  Distribution `torch==2.13.0+cu132` can't be installed because it
  doesn't have a source distribution or wheel for the current platform

Three unconditional CUDA-only pins are responsible:

- ltx-core pins `torch` / `torchaudio` to the cu132 indexes, which ship
  no darwin wheels at all, so no torch version can ever resolve on macOS.
- ltx-trainer pins `torchcodec` / `torchaudio` the same way.
- The root `override-dependencies` entry for `nvidia-cudnn-cu13` has no
  marker, so the CUDA-only cuDNN wheel is forced onto macOS as well.

Attach `sys_platform != 'darwin'` markers to the index sources so macOS
falls back to PyPI (where the MPS-enabled wheels live), and scope the
cuDNN override to Linux. Linux and Windows resolution is unchanged --
the markers only add a fallback where the pinned indexes have nothing to
offer.

Verified on macOS 26 / M-series: `uv sync --package ltx-pipelines`
installs torch 2.13.0 with `torch.backends.mps.is_available() == True`,
and `python -m ltx_pipelines.distilled --help` runs. This also makes the
existing Apple-Silicon-only `mps-sdpa` dependency in ltx-core reachable.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.

1 participant