Files
VoiceStudio/tests/test_pkg_resources_available.py
T
Palash DebnathandClaude Opus 4.8 675cc203ee fix(asr): cap setuptools <80 so pkg_resources stays present (#224) (#225)
Windows v0.3 users hit two transcription failures with models installed:
- WhisperX: "Transcription produced no segments. No module named 'pkg_resources'"
- Whisper PyTorch fallback: "No ASR backend is ready. … set OMNIVOICE_PRELOAD_TTS_ASR=1"

Shared root cause: whisperx / faster-whisper import `pkg_resources` at runtime,
and setuptools 80+ DROPPED the bundled pkg_resources. The existing pin
`setuptools>=75` therefore resolved to 82.0.1 — which has no pkg_resources — so
`import whisperx` fails. That both breaks WhisperX transcription and makes its
is_available() return false, which is why every backend reports "not ready" and
the engine asks for the PyTorch fallback (the user's PowerShell env var never
reached the GUI-launched app, a separate red herring).

Fix: pin `setuptools>=75,<80`. Verified: <80 resolves to 79.0.1 which ships
pkg_resources; 82 does not. `uv lock` changed only setuptools (82.0.1→79.0.1).
This fixes BOTH errors — WhisperX imports again, so it's available and the
fallback is no longer needed.

Adds tests/test_pkg_resources_available.py to guard the pin from regressing.
Full suite 602 passed (incl. the new test), 0 failures.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 11:46:32 +05:30

17 lines
768 B
Python

"""Regression for #224 (and #58): whisperx / faster-whisper import
`pkg_resources` at runtime. setuptools 80+ dropped the bundled pkg_resources,
so an unpinned `setuptools>=75` resolves to a version WITHOUT it — which both
breaks WhisperX transcription ("No module named 'pkg_resources'") and makes its
is_available() report "No ASR backend is ready". The setuptools pin (<80) must
keep a version that still ships pkg_resources.
"""
import importlib.util
def test_pkg_resources_importable():
assert importlib.util.find_spec("pkg_resources") is not None, (
"pkg_resources is missing — the installed setuptools dropped it. "
"Keep the setuptools pin below the version that removed pkg_resources "
"(pyproject.toml / issue #224)."
)