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 kasumi-1 opened this issue 2 years ago • 3 comments

Hi,

I installed whisper-cpp-python using:

pip install "whisper-cpp-python[server]"

However when I run:

python3 -m whisper_cpp_python.server --model models/ggml-tiny.bin

I receive:

Traceback (most recent call last):
  File "<frozen runpy>", line 189, in _run_module_as_main
  File "<frozen runpy>", line 112, in _get_module_details
  File "/opt/homebrew/lib/python3.11/site-packages/whisper_cpp_python/__init__.py", line 1, in <module>
    from .whisper import *
  File "/opt/homebrew/lib/python3.11/site-packages/whisper_cpp_python/whisper.py", line 1, in <module>
    from . import whisper_cpp
  File "/opt/homebrew/lib/python3.11/site-packages/whisper_cpp_python/whisper_cpp.py", line 54, in <module>
    _lib = _load_shared_library(_lib_base_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/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

My system:

OS: macOS 13.6 22G120 arm64
python3 --version: Python 3.11.6

kasumi-1 avatar Nov 06 '23 03:11 kasumi-1

Having the same issue.

@kasumi-1 have you been able to find a solution?

SashaBaych avatar Nov 26 '23 16:11 SashaBaych

The issue might be caused by

def _load_shared_library(lib_base_name: str):
    # Determine the file extension based on the platform
    if sys.platform.startswith("linux"):
        lib_ext = ".so"
    elif sys.platform == "darwin":
        lib_ext = ".so" # here should be .dylib
    elif sys.platform == "win32":
        lib_ext = ".dll"
    else:
        raise RuntimeError("Unsupported platform")

on macos, the lib_ext should be ".dylib".

A workround for this issue is that you can

export WHISPER_CPP_LIB="path/to/libwhisper.dylib"

and then run your code.

kaka1909 avatar Nov 28 '23 12:11 kaka1909

https://github.com/carloscdias/whisper-cpp-python/pull/12#issuecomment-1803553186

Try this fix working ✅

kishorekaruppusamy avatar Feb 15 '24 07:02 kishorekaruppusamy