-
Notifications
You must be signed in to change notification settings - Fork 21
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
Update lib path on macOS #12
base: main
Are you sure you want to change the base?
Conversation
Fix from carloscdias#9 Basically on macOS we were trying to load the wrong file 😊
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This solves #9 for me!
Would be great if you could merge this, thanks! |
For everyone having the same problem on MacOS, I just wrote a hacky solution to patch the import pkgutil
import re
from pathlib import Path
# patch whisper on file not find error
# https://github.com/carloscdias/whisper-cpp-python/pull/12
try:
import whisper_cpp_python
except FileNotFoundError:
regex = r"(\"darwin\":\n\s*lib_ext = \")\.so(\")"
subst = "\\1.dylib\\2"
print("fixing and re-importing whisper_cpp_python...")
# load whisper_cpp_python and substitute .so with .dylib for darwin
package = pkgutil.get_loader("whisper_cpp_python")
whisper_path = Path(package.path)
whisper_cpp_py = whisper_path.parent.joinpath("whisper_cpp.py")
content = whisper_cpp_py.read_text()
result = re.sub(regex, subst, content, 0, re.MULTILINE)
whisper_cpp_py.write_text(result)
import whisper_cpp_python |
Great work @cansik !!! |
Fix from #9
Basically on macOS we were trying to load the wrong file 😊