jugla / worldtidesinfocustom

world tides info custom component for home assistant
MIT License
27 stars 2 forks source link

Platform error sensor.worldtidesinfocustom - numpy.core.multiarray failed to import #18

Closed wildoracle closed 2 years ago

wildoracle commented 2 years ago

Describe the bug A clear and concise description of what the bug is. The system cannot restart because the configuration is not valid: Platform error sensor.worldtidesinfocustom - numpy.core.multiarray failed to import

To Reproduce Steps to reproduce the behavior:

  1. Go to 'Settings>System'
  2. Click on 'Restart'

Expected behavior No errors, allowing me to restart

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 189, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1627, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1664, in _execute_service await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)( File "/usr/src/homeassistant/homeassistant/components/hassio/init.py", line 679, in async_handle_core_service raise HomeAssistantError( homeassistant.exceptions.HomeAssistantError: The system cannot restart because the configuration is not valid: Platform error sensor.worldtidesinfocustom - numpy.core.multiarray failed to import

Automot360 commented 2 years ago

I can confirm this error, It stopped working after update Homeassistant to 2022.5. Error Message: Unable to prepare setup for platform worldtidesinfocustom.sensor: Platform not found (numpy.core.multiarray failed to import)

jugla commented 2 years ago

Hello, It seems to be related to numpy library.

Thanks in advance

wildoracle commented 2 years ago

Hi, sorry I didn't include my specs in the original post. Here you go: Home Assistant Core 2022.5.0 Home Assistant Supervisor 2022.05.0 Home Assistant OS 7.6 Kernel version 5.10.108 Agent version 1.2.1

I have not manually installed numpy so it's probably part of the HA core? I'm guessing numpy is a variant of python? I had some issues with other "add-ons" in this 2022.5 upgrade. I had to restart several such as File editor and ESPHome in order to get them to work correctly. As I was poking around the others, I noticed that the AppDaemon add-on (which I believe HACS takes advantage of for python libraries) had these options (see attached) and "py3-numpy" is shown as a loaded system package. Maybe this is where the incompatibility lies? Screen Shot 2022-05-05 at 1 07 12 PM

PictureMil commented 2 years ago

Hi. Same problem here after upgrading to 2022.5. The camera sensors get created, but all the statistical sensors are gone because of the numpy error.

Automot360 commented 2 years ago

Hi, first of all thank for your work on the Tide Plugin. I’ am using Home Assistant VM on Synology, results in no manual numpy installation. I hope that helps, let me know if I can help with something else.

Sent from my mobile device.

On May 5, 2022, at 14:58, jugla @.***> wrote:

 Hello, It seems to be related to numpy library.

Please, which installation do you have : core, .... ? Have you numpy manually installed ? Thanks in advance

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.

wildoracle commented 2 years ago

I'm also running HA on the VM in Synology in case that helps. The rest of my config info is above. Thanks!

jugla commented 2 years ago

Thanks all for your feed back. It seems to be related to the configuration on synology. NB: on my raspberry pi 4, with HA 2022.5 it works.

jugla commented 2 years ago

Just a try, in your homeassistant directory (e.g. /home/homeassistant/.homeassistant) , can you mofify this file : ~/.homeassistant/custom_components/worldtidesinfocustom/manifest.json change "requirements": ["matplotlib>=3.4.2","pyworldtidesinfo==2.1.0"], into "requirements": ["matplotlib>=3.5.0","pyworldtidesinfo==2.1.0"], The issue is that I don't call numpy directly

jugla commented 2 years ago

In component called by HA 2022.5, the numpy version is 1.21.4. Another guess in the previous file, change : "requirements": ["matplotlib>=3.4.2","pyworldtidesinfo==2.1.0"], into "requirements": ["numpy==1.21.4","matplotlib>=3.4.2","pyworldtidesinfo==2.1.0"],

jugla commented 2 years ago

Please can you give me your feed back ?

jugla commented 2 years ago

NB1 : numpy is a library to perform numeric computation cf. https://numpy.org/ NB2 : py3-numpy is build package https://pkgs.alpinelinux.org/package/edge/community/x86/py3-numpy to get numpy

cyrenaud commented 2 years ago

"requirements": ["numpy==1.21.4","matplotlib>=3.4.2","pyworldtidesinfo==2.1.0"],

Tried this without any luck.

Running on QNAP Virtualisation Station with: Home Assistant Core 2022.5.1 Home Assistant Supervisor 2022.05.0 Home Assistant OS 7.6 Kernel version 5.10.108

PictureMil commented 2 years ago

Yep, same for me. No joy with those tweaks.

Version: core-2022.5.1 Installation Type: Home Assistant OS Development: false Supervisor: true Docker: true User: root Virtual Environment: false Python Version: 3.9.9 Operating System Family: Linux Operating System Version: 5.10.108 CPU Architecture: x86_64

PictureMil commented 2 years ago

I should declare that I am still runing a yaml config for this integration. I probably missed any notifications that were published when a UI config became available. That said; in order to find a fix I have tried deleting the integration and reinstalling with UI config. It still does not work. Anyway, thought I should mention this in case there were any specific steps that a user should take when moving from YAML to UI. Thanks!

jugla commented 2 years ago

Is there anyone with the issue, can, in configuration.yaml, set a trend sensor https://www.home-assistant.io/integrations/trend/ on whatever ? The aim is to see if you have or not the same issue with a component from HA . Wacht out in 2022.5.1 the numpy version has been changed into 1.21.6 .

jugla commented 2 years ago

Question : have you been to this page https://www.pythonpool.com/solved-importerror-numpy-core-multiarray-failed-to-import/ ?

wildoracle commented 2 years ago

In my /config/binary_sensor.yaml file, should I set up my YAML like this? - platform: trend sensors: worldtidesinfo: entity_id: sensor.worldtidesinfo

jugla commented 2 years ago

Hello, There are some carriage return ;-)

# Example configuration.yaml entry
binary_sensor:
  - platform: trend
    sensors:
      cpu_speed:
        entity_id: sensor.cpu_speed

Please use another sensor like sensor.hacs

wildoracle commented 2 years ago

If I were to follow this guide, would I be trying it in the command line within Synology's VM software (where the input cursor is ha >) ? or within the SSH & Web Terminal add-on UI?

wildoracle commented 2 years ago

Hello, There are some carriage return ;-)

# Example configuration.yaml entry
binary_sensor:
  - platform: trend
    sensors:
      cpu_speed:
        entity_id: sensor.cpu_speed

Please use another sensor like sensor.hacs

Oh, yes - it didn't include the carriage returns when I pasted here. :) As for the content of the YAML, I want to monitor sensor.hacs? - platform: trend sensors: hacs: entity_id: sensor.hacs (I don't know how to get github to format YAML correctly.)

jugla commented 2 years ago

don't forget the binary_sensor

jugla commented 2 years ago

Before modifying configuration.yaml, make a backup of this file

wildoracle commented 2 years ago

yes, I have my YAML separated out into a /config/binary_sensor.yaml file

But... I have to comment out the worldtidesinfo lines from my sensor.yaml in order to restart. Will that negate the test?

jugla commented 2 years ago

You can leave worldtidesinfo or comment it out. As you want

wildoracle commented 2 years ago

Is there anyone with the issue, can, in configuration.yaml, set a trend sensor https://www.home-assistant.io/integrations/trend/ on whatever ? The aim is to see if you have or not the same issue with a component from HA . Wacht out in 2022.5.1 the nump version has been changed into 1.21.6 .

OK, I've restarted with the new trend yaml in my binary_sensor.yaml file... what am I needing to look for now?

jugla commented 2 years ago

Do you see the sensor , you have created ?

jugla commented 2 years ago

In the log, I would like to know if you have the same trace numpy.core.multiarray failed to import

wildoracle commented 2 years ago

Pardon my ignorance, but I don't know what the name of the sensor would be but I have this in my logs: Logger: homeassistant.components.binary_sensor Source: /usr/local/lib/python3.9/asyncio/events.py:80 Integration: Binary sensor (documentation, issues) First occurred: 11:12:43 AM (2 occurrences) Last logged: 11:12:43 AM

Setup of binary_sensor platform trend is taking over 10 seconds. Setup of binary_sensor platform hassio is taking over 10 seconds.

And also found this: Logger: root Source: /usr/src/homeassistant/homeassistant/bootstrap.py:326 First occurred: 11:13:05 AM (1 occurrences) Last logged: 11:13:05 AM

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

jugla commented 2 years ago

Thanks a lot @wildoracle It seems we are falling on issue https://github.com/home-assistant/core/issues/71270 Seems to be solved on HA 2022.5.2

jugla commented 2 years ago

HA 2022.5.2 has been released. The issue is there ?

PictureMil commented 2 years ago

Must be pleasing to know it wasn't your code from your brilliant integration! 2022.05.2 hasn't arrived for me yet. Thank you!

jugla commented 2 years ago

:-)

PictureMil commented 2 years ago

A system reboot triggered the new release being on offer. Confirming 2022.05.2 with its rebuilt numpy wheels has fixed this error. May the tides rise and fall!

Nice!

wildoracle commented 2 years ago

THANK YOU for this HACS addon, and for being so helpful! I can also confirm that 2022.5.2 fixed the issue for me.

jugla commented 2 years ago

Thanks all for your feed back