whispercpp icon indicating copy to clipboard operation
whispercpp copied to clipboard

bug: Installing builds for macOS instead of native

Open Martmists-GH opened this issue 10 months ago • 3 comments

Describe the bug

Traceback (most recent call last):
  File "/home/mart/git/experiments/assistant/src/main/resources/whisper_service.py", line 16, in <module>
    class Connection:
  File "/home/mart/git/experiments/assistant/src/main/resources/whisper_service.py", line 24, in Connection
    WHISPER_MODEL = Whisper.from_pretrained("base.en")
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mart/.pyenv/versions/ai-test/lib/python3.12/site-packages/whispercpp/__init__.py", line 105, in from_pretrained
    context = api.Context.from_file(
              ^^^^^^^^^^^
  File "/home/mart/.pyenv/versions/ai-test/lib/python3.12/site-packages/whispercpp/utils.py", line 144, in __getattr__
    self._module = self._load()
                   ^^^^^^^^^^^^
  File "/home/mart/.pyenv/versions/ai-test/lib/python3.12/site-packages/whispercpp/utils.py", line 122, in _load
    module = importlib.import_module(self.__name__)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mart/.pyenv/versions/3.12.0/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1381, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1325, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 915, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 813, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 1288, in create_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
ImportError: /home/mart/.pyenv/versions/ai-test/lib/python3.12/site-packages/whispercpp/api_cpp2py_export.so: invalid ELF header
$ file /home/mart/.pyenv/versions/ai-test/lib/python3.12/site-packages/whispercpp/api_cpp2py_export.so
/home/mart/.pyenv/versions/ai-test/lib/python3.12/site-packages/whispercpp/api_cpp2py_export.so: Mach-O 64-bit arm64 dynamically linked shared library, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL|WEAK_DEFINES|BINDS_TO_WEAK|NO_REEXPORTED_DYLIBS|HAS_TLV_DESCRIPTORS>

To reproduce

Install with pip

Expected behavior

It builds correctly

Environment

python 3.12

Martmists-GH avatar Mar 28 '25 00:03 Martmists-GH

Same here. It's the same error they are seeing on ARM Linux apparently: https://github.com/aarnphm/whispercpp/issues/84

I'm running in an Ubuntu 24.04 Docker container, with Docker Desktop on an Intel Macbook. So no ARM involved in my environment.

root@8d94cd3f0be7:/app/python-api/airwaves# uname -a
Linux 8d94cd3f0be7 6.10.14-linuxkit #1 SMP PREEMPT_DYNAMIC Mon Feb 24 16:37:44 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Traceback (most recent call last):
  File "/app/python-api/airwaves/./transcriber.py", line 181, in <module>
    whisper_model = Whisper.from_pretrained(MODEL_SIZE)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/whispercpp/__init__.py", line 105, in from_pretrained
    context = api.Context.from_file(
              ^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/whispercpp/utils.py", line 144, in __getattr__
    self._module = self._load()
                   ^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/whispercpp/utils.py", line 122, in _load
    module = importlib.import_module(self.__name__)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 921, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 813, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 1289, in create_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
ImportError: /usr/local/lib/python3.12/dist-packages/whispercpp/api_cpp2py_export.so: invalid ELF header
root@8d94cd3f0be7:/app/python-api/airwaves# file /usr/local/lib/python3.12/dist-packages/whispercpp/api_cpp2py_export.so
/usr/local/lib/python3.12/dist-packages/whispercpp/api_cpp2py_export.so: Mach-O 64-bit arm64 dynamically linked shared library, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL|WEAK_DEFINES|BINDS_TO_WEAK|NO_REEXPORTED_DYLIBS|HAS_TLV_DESCRIPTORS>

sheaffej avatar Mar 28 '25 22:03 sheaffej

Oh interesting. @Martmists-GH downgrading to Ubuntu 22.04 solved this for me.

# Dockerfile
#FROM ubuntu:24.04
FROM ubuntu:22.04

sheaffej avatar Mar 28 '25 22:03 sheaffej

I'm not on ubuntu so I don't think I can really downgrade.

Martmists-GH avatar Mar 28 '25 23:03 Martmists-GH