mallorbc / whisper_mic

Project that allows one to use a microphone with OpenAI whisper.
MIT License
674 stars 154 forks source link

Sonoma 14.4.1 - Python 3.12 - Running whisper_mic returns errors #74

Open Golffies opened 3 months ago

Golffies commented 3 months ago

Hi Blake, Here is my environment:

MacOS Sonoma 14.4.1
XCode Command Line Tools 15.3.0.0.1.1708646388
Python 3.12.2
portaudio 19.7.0 (installed with brew)
whisper_mic 1.4.2

Here is the output I get when I run the application:

% ~/opt/dictee/bin/whisper_mic --model medium                 
[04/03/24 17:45:47] INFO     No mic index provided, using default                                                                                             whisper_mic.py:84
Traceback (most recent call last):
  File "/Users/pro/opt/dictee/bin/whisper_mic", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/pro/opt/dictee/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pro/opt/dictee/lib/python3.12/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/Users/pro/opt/dictee/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pro/opt/dictee/lib/python3.12/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pro/opt/dictee/lib/python3.12/site-packages/whisper_mic/cli.py", line 29, in main
    mic = WhisperMic(model=model, english=english, verbose=verbose, energy=energy, pause=pause, dynamic_energy=dynamic_energy, save_file=save_file, device=device,mic_index=mic_index,implementation=("faster_whisper" if faster else "whisper"),hallucinate_threshold=hallucinate_threshold)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pro/opt/dictee/lib/python3.12/site-packages/whisper_mic/whisper_mic.py", line 79, in __init__
    self.__setup_mic(mic_index)
  File "/Users/pro/opt/dictee/lib/python3.12/site-packages/whisper_mic/whisper_mic.py", line 85, in __setup_mic
    self.source = sr.Microphone(sample_rate=16000, device_index=mic_index)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pro/opt/dictee/lib/python3.12/site-packages/speech_recognition/__init__.py", line 80, in __init__
    self.pyaudio_module = self.get_pyaudio()
                          ^^^^^^^^^^^^^^^^^^
  File "/Users/pro/opt/dictee/lib/python3.12/site-packages/speech_recognition/__init__.py", line 111, in get_pyaudio
    from distutils.version import LooseVersion
ModuleNotFoundError: No module named 'distutils'

Maybe it is just that your code is not yet ready for Python 3.12? Thanks a lot for providing us with whisper-mic.

mallorbc commented 2 weeks ago

what happens when you run:

pip install distutils

Looking at the stack trace, this seems to be an issue with the speech recognition library.