Conversation
…#109982) sentencepiece 0.2.2 segfaults on import on some Windows hosts, bypassing every try/except and killing the backend in a respawn loop. Probe native imports in a throwaway interpreter from check_wake_word_requirements and post-ensure in _Engine.__init__ so every arm path refuses with a hint instead of dying. Declare the missing pypinyin dep alongside.
Contributor
Contributor
13 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
On some Windows hosts
sentencepiece==0.2.2dies with an access violationon import — uncatchable in-process, so arming the sherpa wake-word engine
kills the whole backend and the desktop shell respawns it into a crash loop
(124 crashes in a day on the reporter's machine).
try/except Exceptionand the
except ImportErrorinside sherpa-onnx cannot intercept a fatalsignal, and
check_wake_word_requirements()reported the setup as healthy.This PR probes native imports in a throwaway interpreter and refuses to arm
with a remediation hint instead of dying:
tools/wake_word.py— new_native_deps_loadable()subprocess smokeprobe plus
_refuse_unloadable_native_deps(); wired intocheck_wake_word_requirements()(newnative_okfield + ladder rung, sowake.starton every surface refuses before arming).tools/wake_word_engines.py—_Engine.__init__runs the same refusalpost-
ensure(), so directstart_listeningcallers are covered too andfresh installs still reach the lazy installer.
tools/lazy_deps.py,pyproject.toml,uv.lock— declare the missingpypinyin==0.55.0the sherpa engine needs to arm at all (Sherpa wake word fails to arm: No module named 'pypinyin' #74719).Related Issue
Fixes #109982
Type of Change
Changes Made
tools/wake_word.py— subprocess smoke probe, post-ensure refusal hookpoint, requirements wiring (
native_ok+ hint).tools/wake_word_engines.py— refusal runs betweenensure()and_build()in_Engine.__init__.tools/lazy_deps.py/pyproject.toml(wakeextra +[tool.uv.exclude-newer-package]) /uv.lock— declarepypinyin==0.55.0, mirrored in both pin surfaces.tests/tools/test_wake_word.py— 6 regression tests: smokerefusal/success at the requirements gate, out-of-process proof, crash
exit-code mapping, post-ensure refusal order, dispatcher fresh-install
ordering.
How to Test
scripts/run_tests.sh tests/tools/test_wake_word.py tests/tools/test_lazy_deps.py tests/test_project_metadata.pywake_word.enabledtrue —
wake.startnow returnsstarted: falsewith a hint instead ofcrash-looping;
wake_word.enabled falsestays the manual workaround./wake onwith missing deps still reaches the lazyinstaller (pinned by
test_dispatcher_does_not_preempt_lazy_install).Checklist
Code
Documentation & Housekeeping
Exclusions
sentencepieceversion pin: a pin is a dated bandage (this same hostalready fails on
onnxruntime). The guard refuses any unloadable nativewheel, present or future.
onnxruntimeand tflite are out of scope: their failure modeis a catchable import error (already handled), and tflite has its own
ensure_tflite_runtime()bridge.faulthandlerbelong to fix(tui): enable faulthandler so fatal signals leave a stack #99406 / [Bug]: TUI gateway crashes on audio-capture request — NumPy x86_64-v2 wheel incompatible with older CPUs (wake_word → import numpy) #82913, separatedefect class, separate PR.
pypinyinoverlaps the stalled fix(wake): declare pypinyin for the sherpa wake-word engine (#74719) #74733 / fix(wake): install pypinyin into Hermes env for sherpa phrases (#75241) #75321 / fix(wake): upgrade sherpa-onnx to 1.13.5 and declare pypinyin #101851 (none touchessentencepiece); this PR carries only the declaration the sherpa engineneeds, not their wider scope.