whisper-cpp-python icon indicating copy to clipboard operation
whisper-cpp-python copied to clipboard

FileNotFoundError: Shared library with base name 'whisper' not found

Open BeyondLogan opened this issue 11 months ago • 3 comments

Im on Windows running python 3.12.6 and i cant seem to get past this error FileNotFoundError: Shared library with base name 'whisper' not found

The Code from whisper_cpp_python import Whisper whisper = Whisper(model_path="/Main Base/ggml-large-v2.bin") output = whisper.transcribe(open('/Main Base/output.wav')) print(output)

dose anybody know how to fix this issue?

BeyondLogan avatar Jan 06 '25 09:01 BeyondLogan

Facing the same error on Mac with python 3.12.8

python
Python 3.12.8 (main, Dec  6 2024, 19:42:06) [Clang 18.1.8 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from whisper_cpp_python import Whisper
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/foo/code/spk/.venv/lib/python3.12/site-packages/whisper_cpp_python/__init__.py", line 1, in <module>
    from .whisper import *
  File "/Users/foo/code/spk/.venv/lib/python3.12/site-packages/whisper_cpp_python/whisper.py", line 1, in <module>
    from . import whisper_cpp
  File "/Users/foo/code/spk/.venv/lib/python3.12/site-packages/whisper_cpp_python/whisper_cpp.py", line 54, in <module>
    _lib = _load_shared_library(_lib_base_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/foo/code/spk/.venv/lib/python3.12/site-packages/whisper_cpp_python/whisper_cpp.py", line 45, in _load_shared_library
    raise FileNotFoundError(
FileNotFoundError: Shared library with base name 'whisper' not found

epicwhale avatar Jan 06 '25 16:01 epicwhale

The error, apparently, is in the file whisper_cpp.py (in your env under lib/python3.x/site-packages/whisper_cpp_python The method _load_shared_library(lib_base_name:str) tries to load a .so library in OS X but the actual extension is .dylib. If you are on a Mac, you have 3 options:

  • use libwhisper.so
  • change the code lib_ext = ".so" into lib_ext = ".dylib" for platform "darwin"
  • set the env var WHISPER_CPP_LIB
if "WHISPER_CPP_LIB" in os.environ:
        lib_base_name = os.environ["WHISPER_CPP_LIB"]
        _lib = pathlib.Path(lib_base_name)
        _base_path = _lib.parent.resolve()
        _lib_paths = [_lib.resolve()]

advancedlogic avatar Jan 10 '25 00:01 advancedlogic

The error, apparently, is in the file whisper_cpp.py (in your env under lib/python3.x/site-packages/whisper_cpp_python The method _load_shared_library(lib_base_name:str) tries to load a .so library in OS X but the actual extension is .dylib. If you are on a Mac, you have 3 options:

* use libwhisper.so

* change the code lib_ext = ".so" into lib_ext = ".dylib" for platform "darwin"

* set the env var WHISPER_CPP_LIB
if "WHISPER_CPP_LIB" in os.environ:
        lib_base_name = os.environ["WHISPER_CPP_LIB"]
        _lib = pathlib.Path(lib_base_name)
        _base_path = _lib.parent.resolve()
        _lib_paths = [_lib.resolve()]

Wait is if there's a fix for mac OS is there any known fix for windows machines currently?

BeyondLogan avatar Jan 10 '25 04:01 BeyondLogan