chidiwilliams / buzz

Buzz transcribes and translates audio offline on your personal computer. Powered by OpenAI's Whisper.
https://chidiwilliams.github.io/buzz
MIT License
12.41k stars 938 forks source link

Unable to load `whisper` on venv #653

Closed nikto-b closed 4 months ago

nikto-b commented 10 months ago

Way to reproduce:

cd /tmp
python3.9 -m venv ./venv3.9
source venv3.9/bin/activate
pip install buzz-captions

Stacktrace:

[2023-12-23 18:44:25,330] transcriber.<module>:41 ERROR -> 
Traceback (most recent call last):
  File "/tmp/venv3.9/lib/python3.9/site-packages/buzz/transcriber.py", line 37, in <module>
    import buzz.whisper_cpp as whisper_cpp
  File "/tmp/venv3.9/lib/python3.9/site-packages/buzz/whisper_cpp.py", line 863, in <module>
    _libs["whisper"] = load_library("whisper")
  File "/tmp/venv3.9/lib/python3.9/site-packages/buzz/whisper_cpp.py", line 551, in __call__
    raise ImportError("Could not load %s." % libname)
ImportError: Could not load whisper.
Traceback (most recent call last):
  File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/tmp/venv3.9/lib/python3.9/site-packages/buzz/__main__.py", line 4, in <module>
    buzz.buzz.main()
  File "/tmp/venv3.9/lib/python3.9/site-packages/buzz/buzz.py", line 56, in main
    from buzz.cli import parse_command_line
  File "/tmp/venv3.9/lib/python3.9/site-packages/buzz/cli.py", line 7, in <module>
    from buzz.widgets.application import Application
  File "/tmp/venv3.9/lib/python3.9/site-packages/buzz/widgets/application.py", line 8, in <module>
    from buzz.widgets.main_window import MainWindow
  File "/tmp/venv3.9/lib/python3.9/site-packages/buzz/widgets/main_window.py", line 21, in <module>
    from buzz.widgets.main_window_toolbar import MainWindowToolbar
  File "/tmp/venv3.9/lib/python3.9/site-packages/buzz/widgets/main_window_toolbar.py", line 18, in <module>
    from buzz.widgets.recording_transcriber_widget import RecordingTranscriberWidget
  File "/tmp/venv3.9/lib/python3.9/site-packages/buzz/widgets/recording_transcriber_widget.py", line 31, in <module>
    from buzz.widgets.transcriber.transcription_options_group_box import (
  File "/tmp/venv3.9/lib/python3.9/site-packages/buzz/widgets/transcriber/transcription_options_group_box.py", line 12, in <module>
    from buzz.widgets.transcriber.advanced_settings_dialog import AdvancedSettingsDialog
  File "/tmp/venv3.9/lib/python3.9/site-packages/buzz/widgets/transcriber/advanced_settings_dialog.py", line 17, in <module>
    class AdvancedSettingsDialog(QDialog):
  File "/tmp/venv3.9/lib/python3.9/site-packages/buzz/widgets/transcriber/advanced_settings_dialog.py", line 22, in AdvancedSettingsDialog
    self, transcription_options: TranscriptionOptions, parent: QWidget | None = None
TypeError: unsupported operand type(s) for |: 'PyQt6.sip.wrappertype' and 'NoneType'

Looks like switching to python3.10 fixes problem with whisper import, but still crashing while using live recording with "medium"-sized model with such error:

RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory
Fatal Python error: Aborted

Current thread 0x00007ff6a27fc6c0 (most recent call first):
  <no Python frame>

Thread 0x00007ff6a2ffd6c0 (most recent call first):
  <no Python frame>

Thread 0x00007ff6b3fff6c0 (most recent call first):
  File "/usr/lib/python3.10/threading.py", line 320 in wait
  File "/usr/lib/python3.10/queue.py", line 171 in get
  File "/tmp/venv/lib/python3.10/site-packages/buzz/file_transcriber_queue_worker.py", line 39 in run

Thread 0x00007ff78d010740 (most recent call first):
  File "/tmp/venv/lib/python3.10/site-packages/buzz/buzz.py", line 61 in main
  File "/tmp/venv/lib/python3.10/site-packages/buzz/__main__.py", line 4 in <module>
  File "/usr/lib/python3.10/runpy.py", line 86 in _run_code
  File "/usr/lib/python3.10/runpy.py", line 196 in _run_module_as_main
raivisdejus commented 4 months ago

Please see local setup instructions here https://github.com/chidiwilliams/buzz/blob/main/CONTRIBUTING.md and try with poetry For GitHub action builds we use python 3.10.11, that works. On my local I have 3.10.12, it also works.

Reopen if still an issue