linuxserver/docker-homeassistant

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

sigurasg opened this issue · 5 comments

linuxserver.io

Looks like HA updated their matplotlib version to a version that needs a more recent numpy. The same error occurred in the the HA core docker image.


Expected Behavior

At startup this log message should not occur.

Current Behavior

There's a log message "RuntimeError: module compiled against API version 0xf but this version of numpy is 0xe".
See home-assistant/core#71270. Looks like the numpy module is behind the matplotlib API version.

Steps to Reproduce

  1. Update to latest image and start it. Look at the log.

Environment

OS: Ubuntu 21.10
CPU architecture: arm64
How docker service was installed:
With distro, IIRC.

Command used to create docker container (run/create/compose/screenshot)

I use docker-compose.

Docker logs

2022-05-07 15:04:09 ERROR (SyncWorker_3) [root] Uncaught exception
RuntimeError: module compiled against API version 0xf but this version of numpy is 0xe

Thanks for opening your first issue here! Be sure to follow the bug or feature issue templates!

# docker run --entrypoint python3  lscr.io/linuxserver/homeassistant -c 'import numpy; print(numpy.version.version)'
1.21.6
# docker run --entrypoint python3  lscr.io/linuxserver/homeassistant -c 'import matplotlib'
RuntimeError: module compiled against API version 0xf but this version of numpy is 0xe
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.9/site-packages/matplotlib/__init__.py", line 109, in <module>
    from . import _api, _version, cbook, docstring, rcsetup
  File "/usr/lib/python3.9/site-packages/matplotlib/rcsetup.py", line 27, in <module>
    from matplotlib.colors import Colormap, is_color_like
  File "/usr/lib/python3.9/site-packages/matplotlib/colors.py", line 56, in <module>
    from matplotlib import _api, cbook, scale
  File "/usr/lib/python3.9/site-packages/matplotlib/scale.py", line 23, in <module>
    from matplotlib.ticker import (
  File "/usr/lib/python3.9/site-packages/matplotlib/ticker.py", line 136, in <module>
    from matplotlib import transforms as mtransforms
  File "/usr/lib/python3.9/site-packages/matplotlib/transforms.py", line 46, in <module>
    from matplotlib._path import (
ImportError: numpy.core.multiarray failed to import

Yup, aware of it. Matploplib always builds with the latest numpy available, but HA pins numpy version to an older one (no idea why, but that's their business). I need to rebuild the matploplib wheel with an older numpy and then rebuild the HA image and push it. I'll get it done sometime over the weekend.

Unfortunately HA uses about a thousand (not an exaggeration, it is over 1,000) pip packages and they all have multiple layers of deps. Even as it is, we need to run pip with a special flag to build all the wheels otherwise there are too many dep clashes.

In the meantime, you can use it as is (it didn't break anything significant for me, looks like only affects dhcp discovery?), or you can switch to an older tag, or manually compile matploplib with the numpy in there.

Works like a charm now - thanks!