RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd

Viewed 2873

I can import numpy with no issues. However, when trying to import easyocr I'm getting the following error:

>>> %Run numpytst.py
RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd
Traceback (most recent call last):
  File "/home/pi/numpytst.py", line 2, in <module>
    import easyocr
  File "/home/pi/.local/lib/python3.7/site-packages/easyocr/__init__.py", line 1, in <module>
    from .easyocr import Reader
  File "/home/pi/.local/lib/python3.7/site-packages/easyocr/easyocr.py", line 3, in <module>
    from .detection import get_detector, get_textbox
  File "/home/pi/.local/lib/python3.7/site-packages/easyocr/detection.py", line 9, in <module>
    from .craft_utils import getDetBoxes, adjustResultCoordinates
  File "/home/pi/.local/lib/python3.7/site-packages/easyocr/craft_utils.py", line 10, in <module>
    from scipy.ndimage import label
  File "/home/pi/.local/lib/python3.7/site-packages/scipy/ndimage/__init__.py", line 151, in <module>
    from .filters import *
  File "/home/pi/.local/lib/python3.7/site-packages/scipy/ndimage/filters.py", line 37, in <module>
    from . import _nd_image
ImportError: numpy.core.multiarray failed to import

Environment:

  • Raspberry Pi 3B
  • Python 3.7.3
  • numpy 1.16.6
2 Answers

Have you tried to upgrade to a more recent version? like 1.20.x. I solved a similar Error by simply upgrading my NumPy to ver 1.20.3.

The reason could be the mismatch between dependencies. This worked for me:

pip install numpy --upgrade
Related