python-voiceio 1.18.1__py3-none-any.whl → 1.18.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-voiceio
3
- Version: 1.18.1
3
+ Version: 1.18.2
4
4
  Summary: Voice dictation for Linux. Speak → text, locally, instantly.
5
5
  Author: Hugo Montenegro
6
6
  License-Expression: MIT
@@ -1,5 +1,5 @@
1
- python_voiceio-1.18.1.dist-info/licenses/LICENSE,sha256=Gz61o8jFTAvZUZyB3nWDB3DQQVuipjfPkVu9W8hBHM0,1072
2
- voiceio/__init__.py,sha256=54sMzEOXJ7W27qoPLWPsPwh5bgkt77XwgZJbxjD5qB8,23
1
+ python_voiceio-1.18.2.dist-info/licenses/LICENSE,sha256=Gz61o8jFTAvZUZyB3nWDB3DQQVuipjfPkVu9W8hBHM0,1072
2
+ voiceio/__init__.py,sha256=UGngD1th5e8ZpEKcPUfYxQaD9diK7IjChNXBj0_xMOE,23
3
3
  voiceio/__main__.py,sha256=xT5QCGGreYMisHO7Lh_Y-xAQ2TOzG2D7npKknGNcWSY,53
4
4
  voiceio/announce.py,sha256=oqNJn1c4j5bTQ00-LXNWZ3_hIC9L9Lb3rkp0-LwkCfY,3798
5
5
  voiceio/app.py,sha256=tStX_aQyMhFK3NUFWvwowx0jW4a7szX6zkOoP7-lu60,49485
@@ -16,7 +16,7 @@ voiceio/display.py,sha256=ZGBNRjuvg3chkJjduyPJs4s5ZY5vqC_mcaov94PIPzo,5313
16
16
  voiceio/errorlog.py,sha256=e5UKVp4p-UBg0tTpcBREY5KoHMFZFJ9oNK3vOh8H6jw,7044
17
17
  voiceio/feedback.py,sha256=69Vepy2Z0gsDdpLzdLJbgrEHzSJm2luQ7yT4_nAnZCQ,9321
18
18
  voiceio/focus.py,sha256=PGj839UUZE7ZPwaiLDTAX3S8d_QjwaT4y6ugXyylL9M,4304
19
- voiceio/health.py,sha256=x79nI7Jh608mTKYAxZVpNrrzuAmlHxd3_KWkctVM5yE,28698
19
+ voiceio/health.py,sha256=rgFlhTvLe-pneJB2mkQrz8vhvpauBkiA64dkms_etrc,28351
20
20
  voiceio/hints.py,sha256=wQPVie-zX-SFfz3C0YxL40_51SCkF1Xt8F1vwI_5yoY,1440
21
21
  voiceio/history.py,sha256=WNjfjakY8qwgRm3W6WBDlpS9CSgS8ecZ9RGGBZsW80w,5898
22
22
  voiceio/idle_audio.py,sha256=0GEbm0g-a2uVxIMWEKpaYus06mnrc8qvWr09a85FWS0,7225
@@ -26,7 +26,7 @@ voiceio/llm_api.py,sha256=4jJ5U1Dop-3uoM9RM3bjUMxB4kYNNjwKbOwIIj0ll3U,9390
26
26
  voiceio/mic_gain.py,sha256=lMSOz80-cb9X_ggShQttynjVRqcKd1tIUw9e64fEszM,4412
27
27
  voiceio/numbers.py,sha256=CXJtlMhmV6_9Z1FtKAF4-RXycw8voV-BYHPBpdw1I6Y,13571
28
28
  voiceio/pidlock.py,sha256=OZLNskUyv9_F3WgyHZWw8WmKt0W7ioxH6xgHitOwCww,1216
29
- voiceio/platform.py,sha256=4vvr1HZCNdQRl2I-9b9aKsHb_LvHjhfweC_nvPG_JzE,26837
29
+ voiceio/platform.py,sha256=yG3yWgP9xzQ7uXvfBDZ6AfQ3MFClrOh3rGm_YabeYzg,30095
30
30
  voiceio/postcorrect.py,sha256=JN5l9xnyGfYq2_owSUwkJ513QiQQKxCrT3hjU5aJCpg,17322
31
31
  voiceio/postprocess.py,sha256=01ILYaPObF3LZ7oLdCZC1iFQfAFzzGayWFCjCU8RKz8,7121
32
32
  voiceio/power.py,sha256=mKiG5ioHbzgtW2S-OKGFOPzZFbG0HwUUyMn8kE5JRoQ,681
@@ -109,8 +109,8 @@ voiceio/setup/extras.py,sha256=NGk_uAWl4GQAPwRfw_0nEPsPvma7ics9DnZqjoHgCUY,9685
109
109
  voiceio/setup/hotkey.py,sha256=xlDp2vWzsF73wbpvPSrwaqgjtiWnv294nzjlvHy0Ets,6473
110
110
  voiceio/setup/noninteractive.py,sha256=T5c8LTJseqbBGmPOdxWKBP8yH7Q6Se7ir8ORVZFEuog,11573
111
111
  voiceio/setup/speech.py,sha256=6rNGgJyi6-Plxi998o76UbjJv1F2A_sxGOH2Xshz188,9292
112
- voiceio/setup/steps.py,sha256=QdmHC0rk7FB9y0t26MpPPQIige2vx2qUDXbU58-f6Fs,29470
113
- voiceio/setup/system.py,sha256=jCiDJSm4qqSoANy5Qkl80nalyzJNzYxgycE4C6OwZnM,7506
112
+ voiceio/setup/steps.py,sha256=slhCKcWDd6Mf0iI1qSFrSQQhCD3NBvCYpdAN9X53d_U,30138
113
+ voiceio/setup/system.py,sha256=gEFINv_Ofdqj1LMU_QpoWFzGrGv7EYiSsPDC4j6B0sU,7797
114
114
  voiceio/setup/ui.py,sha256=h1gmerT_8EfWftSONUn5K5Ri19elNTRP2lwFAuxsGPc,13401
115
115
  voiceio/sounds/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
116
116
  voiceio/sounds/alert.wav,sha256=raqr2ZVADP49Uv9VUJM7E1itMq0uOp-o5WTyIrGy7gk,38852
@@ -143,8 +143,8 @@ voiceio/typers/pynput_type.py,sha256=f3w131YWJfNGd4IAcWtuKd2Gcwu3467QwGW3OBUEXNI
143
143
  voiceio/typers/wtype.py,sha256=11vOAKHjMat-fITd4sUoUWwgniyVp65EbH3i4mL6Vhg,1762
144
144
  voiceio/typers/xdotool.py,sha256=OuT_zW_z07jSAqu9Cmn_gL1mJfQsiX62ecqFRvpAarQ,1332
145
145
  voiceio/typers/ydotool.py,sha256=lSeYZPnkeKbwDg152t6b76eOmGx5PY0NOxCPd7ORf78,6168
146
- python_voiceio-1.18.1.dist-info/METADATA,sha256=k_btEkNvcVS3wwX2I3bMncKbMzvgb2YLSOnroPskKvI,9629
147
- python_voiceio-1.18.1.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
148
- python_voiceio-1.18.1.dist-info/entry_points.txt,sha256=iDIDmhvQ3xeN_CWsFne1t9STZ08I25I_wp0xmde_vMs,94
149
- python_voiceio-1.18.1.dist-info/top_level.txt,sha256=piwtn309lD6uexQyXdZ-efAVBJF9y6Wfr48Z-8zkNhg,8
150
- python_voiceio-1.18.1.dist-info/RECORD,,
146
+ python_voiceio-1.18.2.dist-info/METADATA,sha256=EBgD_Q76o4QDldowdzznV632B4rZDbuaamWwd22gVcY,9629
147
+ python_voiceio-1.18.2.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
148
+ python_voiceio-1.18.2.dist-info/entry_points.txt,sha256=iDIDmhvQ3xeN_CWsFne1t9STZ08I25I_wp0xmde_vMs,94
149
+ python_voiceio-1.18.2.dist-info/top_level.txt,sha256=piwtn309lD6uexQyXdZ-efAVBJF9y6Wfr48Z-8zkNhg,8
150
+ python_voiceio-1.18.2.dist-info/RECORD,,
voiceio/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "1.18.1"
1
+ __version__ = "1.18.2"
voiceio/health.py CHANGED
@@ -170,10 +170,6 @@ def _kde_input_method_warning(p: plat.Platform, kwinrc: Path | None = None) -> s
170
170
  "System Settings → Keyboard → Virtual Keyboard → IBus Wayland, then log out and in.")
171
171
 
172
172
 
173
- # What CTranslate2 4.x's CUDA build loads at the first encode.
174
- _CUDA_LIBS = ("libcublas.so.12", "libcudnn.so.9")
175
-
176
-
177
173
  def _gpu_libs_warning() -> str:
178
174
  """Why Whisper can't use the GPU it sees, when that's a missing CUDA
179
175
  library (a torch for another CUDA major, pulled in by the train extra,
@@ -184,23 +180,16 @@ def _gpu_libs_warning() -> str:
184
180
  from voiceio.core.decoders.catalog import is_whisper
185
181
  if cfg.device not in ("auto", "cuda") or not is_whisper(cfg.name):
186
182
  return ""
187
- import ctranslate2
188
- if ctranslate2.get_cuda_device_count() == 0:
189
- return ""
190
- except Exception: # noqa: BLE001 — no faster-whisper, or no CUDA build
183
+ except Exception: # noqa: BLE001
191
184
  return ""
192
- import ctypes
193
- missing = []
194
- for lib in _CUDA_LIBS:
195
- try:
196
- ctypes.CDLL(lib)
197
- except OSError:
198
- missing.append(lib)
185
+ missing = plat.missing_cuda_libs()
186
+ if missing is None:
187
+ return plat.cuda_device_problem()
199
188
  if not missing:
200
189
  return ""
201
190
  return (f"A GPU is present but {', '.join(missing)} can't be loaded, so Whisper "
202
- "decodes on CPU. Set model.device = \"cpu\" in config.toml to stay on CPU, "
203
- "or install the CUDA 12 runtime (cuBLAS 12 and cuDNN 9) to use the GPU.")
191
+ f"decodes on CPU. {plat.cuda_libs_hint(missing)}. Or set "
192
+ "model.device = \"cpu\" in config.toml to stay on CPU.")
204
193
 
205
194
 
206
195
  def _check_features() -> FeatureGroups:
voiceio/platform.py CHANGED
@@ -386,6 +386,7 @@ _PKG_NAMES: dict[str, dict[str, str]] = {
386
386
  "portaudio19-dev": "portaudio",
387
387
  "gir1.2-ayatanaappindicator3-0.1": "libayatana-appindicator",
388
388
  "espeak-ng": "espeak-ng",
389
+ "cudnn": "cudnn",
389
390
  },
390
391
  "zypper": {
391
392
  "gir1.2-ibus-1.0": "typelib-1_0-IBus-1_0",
@@ -407,6 +408,9 @@ _PKG_NAMES: dict[str, dict[str, str]] = {
407
408
  },
408
409
  # Gentoo atoms. Names not listed stay bare (`emerge ydotool`), which
409
410
  # emerge resolves when the name is unique in the tree.
411
+ "apt": {
412
+ "cudnn": "nvidia-cudnn",
413
+ },
410
414
  "emerge": {
411
415
  "ibus": "app-i18n/ibus",
412
416
  "gir1.2-ibus-1.0": "app-i18n/ibus", # typelib comes with USE=introspection
@@ -418,6 +422,7 @@ _PKG_NAMES: dict[str, dict[str, str]] = {
418
422
  "xclip": "x11-misc/xclip",
419
423
  "wl-clipboard": "gui-apps/wl-clipboard",
420
424
  "wtype": "gui-apps/wtype",
425
+ "cudnn": "dev-libs/cudnn",
421
426
  },
422
427
  "nix": {
423
428
  "gir1.2-ibus-1.0": "ibus",
@@ -463,6 +468,87 @@ def pkg_install(*packages: str) -> str:
463
468
  return f"{prefix} {' '.join(mapped)}"
464
469
 
465
470
 
471
+ # ── CUDA libraries ───────────────────────────────────────────────────────────
472
+
473
+ # What CTranslate2 4.x's CUDA build loads at the first encode.
474
+ CUDA_LIBS = ("libcublas.so.12", "libcudnn.so.9")
475
+
476
+
477
+ def missing_cuda_libs() -> list[str] | None:
478
+ """The CUDA_LIBS the loader can't open, or None when CTranslate2 sees no
479
+ NVIDIA GPU (or has no CUDA build). [] means the GPU is usable."""
480
+ try:
481
+ import ctranslate2
482
+ if ctranslate2.get_cuda_device_count() == 0:
483
+ return None
484
+ except Exception: # noqa: BLE001 — no faster-whisper, or no CUDA build
485
+ return None
486
+ import ctypes
487
+ missing = []
488
+ for lib in CUDA_LIBS:
489
+ try:
490
+ ctypes.CDLL(lib)
491
+ except OSError:
492
+ missing.append(lib)
493
+ return missing
494
+
495
+
496
+ def nvidia_gpu_present() -> bool:
497
+ """An NVIDIA GPU with its kernel driver loaded, asked of the OS rather
498
+ than of CTranslate2 (which reports 0 devices when libcuda won't load)."""
499
+ if os.path.exists("/proc/driver/nvidia/version") or os.path.exists("/dev/nvidia0"):
500
+ return True
501
+ if not shutil.which("nvidia-smi"):
502
+ return False
503
+ import subprocess
504
+ try:
505
+ r = subprocess.run(["nvidia-smi", "-L"], capture_output=True, text=True, timeout=3)
506
+ except (OSError, subprocess.SubprocessError):
507
+ return False
508
+ return r.returncode == 0 and "GPU" in r.stdout
509
+
510
+
511
+ def cuda_device_problem() -> str:
512
+ """Why CTranslate2 sees no CUDA device on a machine that has an NVIDIA
513
+ GPU, or "" (no GPU, no CTranslate2, or it sees the device)."""
514
+ try:
515
+ import ctranslate2
516
+ except Exception: # noqa: BLE001 — no faster-whisper installed
517
+ return ""
518
+ try:
519
+ if ctranslate2.get_cuda_device_count() > 0:
520
+ return ""
521
+ except Exception: # noqa: BLE001 — treat a failing query as no device
522
+ pass
523
+ if not nvidia_gpu_present():
524
+ return ""
525
+ import ctypes
526
+ try:
527
+ ctypes.CDLL("libcuda.so.1")
528
+ why = ""
529
+ except OSError:
530
+ why = " (libcuda.so.1 can't be loaded)"
531
+ return (f"NVIDIA GPU found, but CTranslate2 sees no CUDA device{why}: check that "
532
+ "the driver's libcuda.so.1 loads (ldconfig -p | grep libcuda.so.1) and "
533
+ "that nvidia-smi works.")
534
+
535
+
536
+ def cuda_libs_hint(missing: list[str]) -> str:
537
+ """Where to look for the libraries missing_cuda_libs() named."""
538
+ hint = ""
539
+ if any("cudnn" in lib for lib in missing):
540
+ hint = "cuDNN 9 is a separate package from the CUDA toolkit"
541
+ # Only the managers whose package name we know; others stay generic.
542
+ mgr = _detect_pkg_manager()
543
+ if "cudnn" in _PKG_NAMES.get(mgr, {}):
544
+ # Older Debian/Ubuntu releases package cuDNN 8; NVIDIA's repo has 9.
545
+ alt = " or NVIDIA's CUDA repo" if mgr == "apt" else ""
546
+ hint += f" ({pkg_install('cudnn')}{alt})"
547
+ hint += ". "
548
+ return (hint + "The libraries must be on the loader path: "
549
+ "ldconfig -p | grep -E 'cublas.so.12|cudnn.so.9'")
550
+
551
+
466
552
  # ── System-dependency preflight ──────────────────────────────────────────────
467
553
  #
468
554
  # The #1 install funnel killer is missing *system* packages: a C toolchain to
voiceio/setup/steps.py CHANGED
@@ -179,9 +179,7 @@ def _print_capability_checks(checks: dict) -> None:
179
179
  "fallback" if checks["xdotool"] else f"optional: {pkg_install('xdotool')}",
180
180
  optional=True)
181
181
 
182
- _print_check("CUDA GPU", checks["cuda"],
183
- "will use GPU" if checks["cuda"] else "will use CPU (still fast)",
184
- optional=True)
182
+ _print_cuda_check(checks)
185
183
 
186
184
  if checks["is_linux"]:
187
185
  from voiceio.hotkeys.evdev import NOT_NEEDED_ON_X11
@@ -194,6 +192,23 @@ def _print_capability_checks(checks: dict) -> None:
194
192
  _print_check("Keyboard access (evdev)", False, evdev_access_hint())
195
193
 
196
194
 
195
+ def _print_cuda_check(checks: dict) -> None:
196
+ missing = checks.get("cuda_missing")
197
+ if missing: # an NVIDIA GPU, but CTranslate2 can't load its libraries
198
+ from voiceio.platform import cuda_libs_hint
199
+ _print_check("CUDA GPU", False,
200
+ f"GPU found, but {', '.join(missing)} can't be loaded: will use CPU",
201
+ optional=True)
202
+ print(f" {DIM}{cuda_libs_hint(missing)}{RESET}")
203
+ elif problem := checks.get("cuda_device_problem"):
204
+ _print_check("CUDA GPU", False, "will use CPU", optional=True)
205
+ print(f" {DIM}{problem}{RESET}")
206
+ else:
207
+ _print_check("CUDA GPU", checks["cuda"],
208
+ "will use GPU" if checks["cuda"] else "will use CPU (still fast)",
209
+ optional=True)
210
+
211
+
197
212
  def _print_tray_check() -> bool:
198
213
  from voiceio.tray import probe_availability
199
214
  tray_ok, tray_reason, tray_fix_hint = probe_availability()
voiceio/setup/system.py CHANGED
@@ -131,6 +131,11 @@ def _check_system() -> dict:
131
131
  checks["cuda"] = "cuda" in ctranslate2.get_supported_compute_types("cuda")
132
132
  except Exception:
133
133
  checks["cuda"] = False
134
+ from voiceio.platform import missing_cuda_libs
135
+ checks["cuda_missing"] = missing_cuda_libs() # None: CTranslate2 sees no GPU
136
+ if checks["cuda_missing"] is None:
137
+ from voiceio.platform import cuda_device_problem
138
+ checks["cuda_device_problem"] = cuda_device_problem()
134
139
 
135
140
  # evdev keyboard access (Linux only): udev uaccess rule or input group
136
141
  checks["evdev_access"] = False