Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kasumi-1 opened this issue Nov 6, 2023 · 3 comments
Open

Comments

@kasumi-1
Copy link

kasumi-1 commented Nov 6, 2023

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
@SashaBaych
Copy link

Having the same issue.

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

@kaka1909
Copy link

kaka1909 commented Nov 28, 2023

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.

@kishorekaruppusamy
Copy link

#12 (comment)

Try this fix working ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants