2023-08-18

「SystemError: initialization of _internal failed without raising an exception」の対処法


目次


エラー内容

whisperのimport時に発生

python main.py
Traceback (most recent call last):
  File "/path/to/main.py", line 3, in <module>
    import whisper
  File "/opt/homebrew/anaconda3/lib/python3.9/site-packages/whisper/__init__.py", line 13, in <module>
    from .model import ModelDimensions, Whisper
  File "/opt/homebrew/anaconda3/lib/python3.9/site-packages/whisper/model.py", line 13, in <module>
    from .transcribe import transcribe as transcribe_function
  File "/opt/homebrew/anaconda3/lib/python3.9/site-packages/whisper/transcribe.py", line 20, in <module>
    from .timing import add_word_timestamps
  File "/opt/homebrew/anaconda3/lib/python3.9/site-packages/whisper/timing.py", line 7, in <module>
    import numba
  File "/opt/homebrew/anaconda3/lib/python3.9/site-packages/numba/__init__.py", line 43, in <module>
    from numba.np.ufunc import (vectorize, guvectorize, threading_layer,
  File "/opt/homebrew/anaconda3/lib/python3.9/site-packages/numba/np/ufunc/__init__.py", line 3, in <module>
    from numba.np.ufunc.decorators import Vectorize, GUVectorize, vectorize, guvectorize
  File "/opt/homebrew/anaconda3/lib/python3.9/site-packages/numba/np/ufunc/decorators.py", line 3, in <module>
    from numba.np.ufunc import _internal
SystemError: initialization of _internal failed without raising an exception

対処法

pip install "numpy<1.20"

whisperはNumbaというライブラリを内部で使っているようで、Numbaを使うにはNumPyの 1.20 かそれ以下のバージョンが必要だった様子

ImportError: Numba needs NumPy 1.20 or less

本日の紹介🔖

📚
天才性が見つかる 才能の地図

「才能は存在しない」「好きと得意で探してはいけない」など今までと違う視点からの自己分析について知れる面白い書籍でした🌦️