Skip to content

fix(setup): install mlx-lm and mlx-audio in setup-python on Apple Silicon#892

Open
flowbrix wants to merge 2 commits into
jamiepine:mainfrom
flowbrix:fix/setup-python-mlx-deps
Open

fix(setup): install mlx-lm and mlx-audio in setup-python on Apple Silicon#892
flowbrix wants to merge 2 commits into
jamiepine:mainfrom
flowbrix:fix/setup-python-mlx-deps

Conversation

@flowbrix

@flowbrix flowbrix commented Jul 13, 2026

Copy link
Copy Markdown

Problem

On a fresh Apple Silicon dev setup, just setup installs backend/requirements-mlx.txt but not mlx-audio/mlx-lm themselves, so the Whisper MLX STT path is broken out of the box: POST /transcribe fails with No module named 'mlx_audio' (and, once that is installed, No module named 'mlx_lm').

These two packages are intentionally absent from requirements-mlx.txt because from mlx-audio 0.3.1 / mlx-lm 0.31.1 onward they declare transformers>=5.x, which conflicts with the transformers<=4.57.x cap in requirements.txt (see the existing note in backend/requirements-mlx.txt). The release workflow (.github/workflows/release.yml) already handles this by installing both with --no-deps — but the dev setup recipe never got the same treatment.

Fix

Mirror the release workflow in the Apple Silicon branch of the setup-python recipe ([unix] section; [windows] is unaffected since MLX is macOS-only):

  • pip install --no-deps mlx-lm==0.31.1
  • pip install --no-deps mlx-audio==0.4.1

with a comment explaining the --no-deps (transformers conflict), plus a pointer to the justfile in the requirements-mlx.txt note. Pins match release.yml so dev and CI stay in sync.

Verification

Ran just setup-python in a clean checkout (no pre-existing venv) on an Apple Silicon Mac — completed successfully, and:

$ backend/venv/bin/python -c "import mlx_audio, mlx_lm"   # OK
$ backend/venv/bin/python -c "import mlx_audio.stt, mlx_audio.tts"   # OK

with mlx-audio 0.4.1 / mlx-lm 0.31.1 resolved as pinned.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Expanded Apple Silicon (macOS arm64) MLX setup to include required audio and language packages.
  • Documentation
    • Updated MLX installation guidance to reference additional setup instructions.
    • Clarified and reinforced installation reliability by pinning compatible MLX package versions during setup.
  • Tests
    • Added a Darwin/Apple Silicon MLX smoke test to verify key MLX, audio (TTS/STT), and language (load/generate) entry points import and run.

…icon

The dev setup installed requirements-mlx.txt but not mlx-audio/mlx-lm
themselves, so POST /transcribe failed on a fresh Apple Silicon setup
with "No module named 'mlx_audio'" (then "No module named 'mlx_lm'").
The release workflow already installs both with --no-deps (they declare
transformers>=5.x, conflicting with our <=4.57.x cap); mirror that in
the setup-python recipe with the same pins.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0d94b0a1-1643-431f-9e66-05c4a63f5431

📥 Commits

Reviewing files that changed from the base of the PR and between f23fca1 and bb0e990.

📒 Files selected for processing (1)
  • backend/tests/test_mlx_smoke.py

📝 Walkthrough

Walkthrough

The Apple Silicon setup-python recipe now installs pinned mlx-lm and mlx-audio packages with --no-deps. A Darwin arm64 smoke-test module validates MLX core, audio, and language-model entry points.

Changes

MLX setup and validation

Layer / File(s) Summary
Pinned MLX installation
justfile, backend/requirements-mlx.txt
The Apple Silicon setup installs mlx-lm==0.31.1 and mlx-audio==0.4.1 without dependencies, and the requirements comment references the setup-python recipe.
MLX runtime smoke tests
backend/tests/test_mlx_smoke.py
Darwin arm64-only tests verify MLX core array execution and callable MLX audio TTS, STT, and language-model entry points.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: installing mlx-lm and mlx-audio in setup-python for Apple Silicon.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
justfile (1)

75-80: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Add an automated MLX smoke test. The --no-deps split is already documented, but backend/tests/test_qwen_download.py is a manual script and won’t run under pytest, so the mlx_audio import/download path still isn’t guarded in CI. Add a small smoke check for mlx_audio plus one TTS/STT path.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@justfile` around lines 75 - 80, The MLX installation commands lack an
automated CI smoke test for the mlx_audio import and runtime path. Add a
pytest-discoverable smoke test near the existing Qwen download test that imports
mlx_audio and exercises one TTS or STT operation, keeping the check small and
compatible with the installed MLX dependencies.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@justfile`:
- Around line 75-80: The MLX installation commands lack an automated CI smoke
test for the mlx_audio import and runtime path. Add a pytest-discoverable smoke
test near the existing Qwen download test that imports mlx_audio and exercises
one TTS or STT operation, keeping the check small and compatible with the
installed MLX dependencies.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6e17eb7c-4edc-492c-acc1-752d3e2cbbf6

📥 Commits

Reviewing files that changed from the base of the PR and between f2cf2a7 and f23fca1.

📒 Files selected for processing (2)
  • backend/requirements-mlx.txt
  • justfile

mlx-audio and mlx-lm are installed --no-deps, so a missing transitive
dependency only surfaces at import time. Add a pytest-discoverable
smoke test (skipped off Apple Silicon) covering the exact entry points
the backend uses: mlx_audio.tts.load, mlx_audio.stt.load (which also
exercises the miniaudio dep from issue jamiepine#505), mlx_lm.load/generate,
and a basic mlx.core op.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@flowbrix

Copy link
Copy Markdown
Author

Addressed the CodeRabbit nitpick: added backend/tests/test_mlx_smoke.py (bb0e990), a pytest-discoverable smoke test that runs under just test. It is skipped off Apple Silicon and covers the exact entry points the backend uses — mlx_audio.tts.load, mlx_audio.stt.load (which also exercises the miniaudio dep from #505), mlx_lm.load/generate, plus a basic mlx.core op. Verified locally on Apple Silicon: 4 passed.

🤖 Addressed by Claude Code

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