Skip to content

Fix: just setup omits mlx-audio/mlx-lm install on Apple Silicon - #681

Closed
august-hill wants to merge 1 commit into
jamiepine:mainfrom
august-hill:fix/just-setup-mlx-audio
Closed

august-hill wants to merge 1 commit into
jamiepine:mainfrom
august-hill:fix/just-setup-mlx-audio

Conversation

@august-hill

@august-hill august-hill commented May 20, 2026 •

Copy link
Copy Markdown

Problem

A fresh just setup on Apple Silicon produces a venv missing the mlx_audio module. Any MLX model load — e.g. downloading Whisper for dictation — then fails with:

ModuleNotFoundError: No module named 'mlx_audio'

In the app this surfaces as a model download that appears to stall on "Connecting to download…": the background download task raises immediately, but the progress UI is never moved off its initial state, so it looks like a hung/slow download rather than an error.

Root cause

backend/requirements-mlx.txt intentionally excludes mlx-audio — from 0.3.1 it declares transformers>=5.x, which conflicts with the transformers<=4.57.6 cap in requirements.txt. That file's own comment says to install it separately with pip install --no-deps mlx-audio==0.4.1, pointing to .github/workflows/release.yml.

release.yml does exactly that. But setup-python in the justfile — the path every contributor and local builder uses — installs requirements-mlx.txt and stops. Release builds get mlx-audio; local dev/build setups silently do not.

Fix

Add the two --no-deps installs to the Apple Silicon branch of setup-python, mirroring release.yml:

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

Windows setup-python is unaffected (no MLX path). One file changed (justfile).

Testing

On an M-series Mac, after applying the fix:

  • python -c "import mlx_audio, mlx_lm" succeeds.
  • The whisper-turbo model (openai/whisper-large-v3-turbo, 1.62 GB) downloads and loads:
    INFO: Marked whisper-turbo as complete
    INFO: MLX Whisper model turbo loaded successfully
    

Note on the PR checklist

CONTRIBUTING.md asks contributors to update CHANGELOG.md, but CHANGELOG.md's header states it is compiled automatically and must not be edited manually. I left it untouched accordingly — flagging the doc inconsistency in case the checklist wording should be revisited.

Summary by CodeRabbit

  • Chores
    • Updated Python environment setup for Apple Silicon systems to install specific package versions with enhanced dependency management, preventing potential runtime conflicts.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 20, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b9bd2a10-f7a2-4b92-a69d-6e439f1afe50

📥 Commits

Reviewing files that changed from the base of the PR and between b35b909 and 36e7868.

📒 Files selected for processing (1)
  • justfile

📝 Walkthrough

Walkthrough

The justfile now explicitly pins and installs MLX packages (mlx-lm==0.31.1 and mlx-audio==0.4.1) using pip install --no-deps on Apple Silicon systems during the setup-python target, avoiding dependency conflicts and runtime issues.

Changes

MLX Package Installation for Apple Silicon

Layer / File(s) Summary
MLX pip installs with fixed versions
justfile
Added two --no-deps pip install steps for mlx-lm==0.31.1 and mlx-audio==0.4.1 within the existing Apple Silicon branch of setup-python, guarded by existing MLX checks and including explanatory comments about avoiding dependency conflicts and missing runtime dependencies.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • jamiepine/voicebox#482: Implements the same MLX workaround to avoid transformers dependency conflicts for pinned mlx-lm and mlx-audio packages.
  • jamiepine/voicebox#506: Addresses mlx-audio STT dependency gaps by explicitly adding miniaudio to work with --no-deps installs of the same pinned packages.

Poem

🐰 Silicon arm embraces MLX with care,
No-deps installs guard dependencies fair,
Version pinned to 0.31, audio too,
Apple's Apple keeps the workflow true! 🍎

🚥 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 and specifically describes the main fix: adding missing mlx-audio and mlx-lm installations for Apple Silicon in the justfile setup process.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 and usage tips.

KurzonDax pushed a commit to KurzonDax/voicebox that referenced this pull request Jun 27, 2026
Cherry-picked from upstream PRs:
- jamiepine#629: Refinement language preservation (captures.py + refinement.py)
  Non-English transcripts were being translated to English during
  refinement. Adds language-lock header + 'Do not translate' instruction
  + Chinese few-shot example.
- jamiepine#681: Apple Silicon MLX setup (justfile)
  Adds --no-deps install of mlx-lm==0.31.1 mlx-audio==0.4.1 to fix
  broken fresh installs (transformers version conflict).
- jamiepine#788: Kokoro male Mandarin voices (kokoro_backend.py)
  Adds 4 missing male Mandarin Chinese voices: zm_yunjian, zm_yunxi,
  zm_yunxia, zm_yunyang.
- jamiepine#667: SQLite WAL mode + busy timeout (session.py)
  Fixes 'database is locked' errors under concurrent load.
  PRAGMA journal_mode=WAL, busy_timeout=5000.
- jamiepine#539: Intel XPU IPEX optional (app.py + base.py + health.py)
  Makes IPEX import optional (try/except). Fixes Intel Arc/XPU support
  without requiring IPEX. (Task spec said jamiepine#538, actual PR is jamiepine#539.)
- jamiepine#621: Model cache validation (pytorch_backend.py + numpy compat)
  Checks for config files (not just weight files). Fixes partial cache
  detection crashes. Refactors pyi_rth_numpy_compat into testable
  _install_torch_numpy_fallback function with regression tests.
- jamiepine#677: HF cache permissions + startup fallback (app.py + docker-compose.yml)
  Sets HF_HUB_CACHE env var with fallback. Fixes container permission
  issues.
KurzonDax pushed a commit to KurzonDax/voicebox that referenced this pull request Jun 27, 2026
…ical fixes plus cache-validation test coverage (IPEX optional, MLX setup, SQLite WAL, refinement language preservation, Kokoro male Mandarin, HF cache permissions, model cache validation, pyi_rth refactor)

Cherry-picks (with IPEX jamiepine#538/jamiepine#539 ordering verified by content):
- PR jamiepine#629 — Refinement language preservation (zh/fr/ja/ru lock + few-shot demo)
- PR jamiepine#681 — Apple Silicon MLX setup (justfile --no-deps mlx-lm/mlx-audio pins)
- PR jamiepine#788 — Kokoro male Mandarin voices (4 zm_ voices)
- PR jamiepine#667 — SQLite WAL journal mode + 5s busy_timeout via SQLAlchemy creator lambda
- PR jamiepine#538 — Intel XPU IPEX optional (native torch.xpu first, IPEX optional)
- PR jamiepine#621 — Model cache validation (require config/preprocessor/tokenizer files in Whisper snapshots)
- PR jamiepine#677 — HF cache permissions (HF_HUB_CACHE under /app/data for non-root containers)
- PR (refactor) — pyi_rth_numpy_compat: extract _install_torch_numpy_fallback to a testable module-level function (3 new tests)

Zeph added 3 regression tests in test_pytorch_cache_validation.py to cover the partial-cache guard in PyTorchSTTBackend._is_model_cached (no other workers covered the missing-preprocessor_config case).

Test results on merged main: 95 passed / 1 pre-existing failure (test_hf_progress_tracker — unrelated, fails on both sides of the merge).

Review checklist:
[x] IPEX fix verified — try/except inversion matches jamiepine#538 content (try IPEX, fall back to native torch.xpu)
[x] Each cherry-pick matches its upstream diff
[x] No secrets, no merge markers, no debug leftovers
[x] SQLite WAL uses SQLAlchemy creator= lambda (correct pattern)
[x] justfile MLX pins mlx-lm==0.31.1 / mlx-audio==0.4.1 (matches release.yml)
[x] Tests run from branch and merged tree — no regressions
[x] Lint: no new ruff errors introduced vs main baseline (993 vs 1008 — actually 15 fewer)
KurzonDax pushed a commit to KurzonDax/voicebox that referenced this pull request Jun 27, 2026
Cherry-pick PR jamiepine#796 — capture preview placement with 6 options:
- Persisted preview_location setting (top/bottom × left/center/right)
- Rust window positioning using selected location + monitor containing cursor
- DictatePreviewState with mutex-protected location
- i18n translations for en/ja/zh-CN/zh-TW
- Frontend dropdown in Capture settings

Skips justfile MLX audio fix (duplicates jamiepine#681 already merged in T3).
KurzonDax pushed a commit to KurzonDax/voicebox that referenced this pull request Jun 27, 2026
Cherry-pick selected files from PR jamiepine#743 (excludes mlx_backend.py —
superseded by jamiepine#789 already merged):

1. app/src/lib/hooks/useGenerationProgress.ts — SSE reconnect with
   exponential backoff (base 1s, max 30s, cap 8 attempts). Replaces
   invalidateQueries with refetchQueries. Adds errorCountRef and
   reconnectTimersRef for reconnect state tracking.

2. backend/services/generation.py — _validate_generated_audio: checks
   sample_rate > 0, audio not None/empty, finite values (no NaN/Inf).
   Adds logger.exception for structured error logging on generation
   failures.

3. backend/services/task_queue.py — traceback.print_exc() replaced with
   logger.exception() for proper structured logging.

4. app/src/lib/api/types.ts — backend_variant comment updated to
   include xpu and metal.

5. backend/models.py — backend_variant comment updated to include
   xpu and metal.

6. backend/routes/health.py — adds metal variant for MLX backend_type.

7. justfile — mlx-lm/mlx-audio --no-deps install already applied
   in prior merge (T3/jamiepine#681).

Also adds 12 tests for _validate_generated_audio covering: valid audio
(np array and list), None audio, empty audio (array and list), zero/
negative/None sample_rate, NaN, +Inf, -Inf, and multichannel audio.
@august-hill august-hill closed this by deleting the head repository Jul 2, 2026
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