Issue with numpy

I suddenly started having issues with the numpy installation in appdaemon, it may have been when updating to homeassistant 2021.8.1. It now says:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

    https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

  * The Python version is: Python3.9 from "/usr/bin/python3"
  * The NumPy version is: "1.21.1"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: No module named 'numpy.core._multiarray_umath'

My homeassistant installation states this:

Host Operating System 	Debian GNU/Linux 10 (buster)
Update Channel 	stable
Supervisor Version 	supervisor-2021.06.8
Docker Version 	20.10.8
Disk Total 	108.1 GB
Disk Used 	81.7 GB
Healthy 	true
Supported 	true
Supervisor API 	ok
Version API 	ok
Installed Add-ons 	AppDaemon 4 (0.7.0), Mosquitto broker (6.0.1), Plejd (0.8.0-beta), File editor (5.2.0), Check Home Assistant configuration (3.8.0), Grafana (7.2.0), InfluxDB (4.2.1), Duck DNS (1.13.0), Dnsmasq (1.4.4), Z-Wave JS (0.1.37), Node-RED (9.1.1)

I have added numpy in requirements.txt which I put in the same folder as appdaemon.yaml, is there anything else I could do to get this working?

1 Like

I have the same problem. Did you find a solution?

Nope, it seems the solution is not known. I would expect more people to want to use numpy with appdaemon. I mean if I check the python version in the installation, it’s not python3.9, it’s python3.7. On the other hand it’s running in a docker so I don’t know what it’s actually running.

Hi everyone,

I don’t use numpy myself, but I am quite familiar with it. I checked that if you start AppDaemon with the following config, you get the error you mentioned.

system_packages: []
python_packages: [numpy]
init_commands:
- python3 -c 'import numpy as np; print(np.__version__)'

So, I started exploring the problem, and it seems that AppDaemon is running in an Alpine Linux, and this type of packages normally gives problem for this Linux distro. It is when I found a system package for the Alpine distro that installs numpy (py3-numpy), so you could change the config for the following:

system_packages: [py3-numpy]
python_packages: []
init_commands:
- python3 -c 'import numpy as np; print(np.__version__)'

This worked for me. It gave me back the numpy version 1.20.3 (which is not the latest). The important part is the py3-numpy, the rest can just be ommited.

Hope this helps.

Regards,
Xavi M.

2 Likes

Perfect. This worked for me.

1 Like

Thanks, it works for me too! I changed the configuration under supervisor for appdaemon (I first tried to find a file manually so I’m putting this info here for others who might have the same issue)

1 Like