whispercpp icon indicating copy to clipboard operation
whispercpp copied to clipboard

bug: linux wheel Import Error

Open zhqu1148980644 opened this issue 1 year ago • 4 comments

Describe the bug

The package installed from pypi causes the following erros:

Python 3.11.2 (main, Mar 23 2023, 17:12:29) [GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from whispercpp import Whisper
>>>
>>> w = Whisper.from_pretrained("tiny.en")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.11/site-packages/whispercpp/__init__.py", line 105, in from_pretrained
    context = api.Context.from_file(
              ^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/whispercpp/utils.py", line 144, in __getattr__
    self._module = self._load()
                   ^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/whispercpp/utils.py", line 122, in _load
    module = importlib.import_module(self.__name__)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 676, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 573, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 1233, in create_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
ImportError: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /usr/local/lib/python3.11/site-packages/whispercpp/api_cpp2py_export.so)

Then I rebuild the package using the latest source, the program creashed.

Python 3.11.2 (main, Mar 23 2023, 17:12:29) [GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from whispercpp import Whisper
>>>
>>> w = Whisper.from_pretrained("tiny.en")
Illegal instruction (core dumped)

To reproduce

  1. docker run -i -t python:3 bash
  2. pip install whispercpp
root@495bbb253133:/# pip install whispercpp
Collecting whispercpp
  Downloading whispercpp-0.0.17-cp311-cp311-manylinux2014_x86_64.whl (1.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.5/1.5 MB 2.5 MB/s eta 0:00:00
Installing collected packages: whispercpp
Successfully installed whispercpp-0.0.17
  1. Run codes in readme.
  2. Rebuild and reinstall package using python3 -m build -w
  3. Run codes in readme.

Expected behavior

No response

Environment

python: 3.11 platform: x86-64 Debian GNU/Linux 11 (bullseye)

zhqu1148980644 avatar Mar 25 '23 16:03 zhqu1148980644

Had that one too. This bug is not caused by the bindings but by whisper.cpp I suppose. It is simply linked to your Distro-Version being outdated by now. I had this first on Linux Mint Una, it was fixed by upgrading to 21.

sorgfresser avatar Apr 23 '23 18:04 sorgfresser

Had that one too. This bug is not caused by the bindings but by whisper.cpp I suppose. It is simply linked to your Distro-Version being outdated by now. I had this first on Linux Mint Una, it was fixed by upgrading to 21.

Hello,what does the 21 version here refer to.

yanchujian avatar Dec 14 '23 03:12 yanchujian

The linux mint version 21, i.e. Vanessa. This bug should relate to some .so files being outdated. You could either manually upgrade this or dump your distro.

sorgfresser avatar Dec 14 '23 06:12 sorgfresser

I had the same problem. Whenever I attempted loading a model - I got "Illegal instruction (core dumped)". Here I found the the issue could be in the CPU and it worked for me.

I got this error on a server with Xeon E5-2687W CPU (manufactured back in 2012) When I changed it to AMD Ryzen Threadripper PRO 5955WX (2022) - all worked fine.

If that doesn't help you, I also found that it could be a bug with numpy, try downgrading in to 1.19.4

Nik-Kras avatar Sep 19 '24 12:09 Nik-Kras