Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Numpy 2.0.0 conflicting breaking Plugin HASS #2013

Open
MartijnAdriaanse opened this issue Jun 21, 2024 · 18 comments
Open

Numpy 2.0.0 conflicting breaking Plugin HASS #2013

MartijnAdriaanse opened this issue Jun 21, 2024 · 18 comments
Labels
bug Something isn't working work_in_progress Isse or PR that is evolving and shouldn't;t be aged out

Comments

@MartijnAdriaanse
Copy link

What happened?

When loading the most recent Pandas package, Numpy 2.0.0 also gets loaded. This breaks the import of HASS. See log file. Workaround of specifying numpy==1.26.4 resolves the issue.

Version

4.4.2

Installation type

Home Assistant add-on

Relevant log output

2024-06-21 11:49:08.013912 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2024-06-21 11:49:08.108065 WARNING AppDaemon: error loading plugin: HASS - ignoring
2024-06-21 11:49:08.108171 WARNING AppDaemon: ------------------------------------------------------------
2024-06-21 11:49:08.109872 WARNING AppDaemon: Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/appdaemon/plugin_management.py", line 140, in __init__
    mod = __import__(full_module_name, globals(), locals(), [module_name], 0)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/appdaemon/plugins/hass/hassplugin.py", line 14, in <module>
    from deepdiff import DeepDiff
  File "/usr/lib/python3.11/site-packages/deepdiff/__init__.py", line 10, in <module>
    from .diff import DeepDiff
  File "/usr/lib/python3.11/site-packages/deepdiff/diff.py", line 18, in <module>
    from deepdiff.helper import (strings, bytes_type, numbers, uuids, times, ListItemRemovedOrAdded, notpresent,
  File "/usr/lib/python3.11/site-packages/deepdiff/helper.py", line 63, in <module>
    np_float_ = np.float_
                ^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/numpy/__init__.py", line 397, in __getattr__
    raise AttributeError(
AttributeError: `np.float_` was removed in the NumPy 2.0 release. Use `np.float64` instead.

2024-06-21 11:49:08.110010 WARNING AppDaemon: ------------------------------------------------------------

Relevant code in the app or config file that caused the issue

No response

Anything else?

No response

@MartijnAdriaanse MartijnAdriaanse added the bug Something isn't working label Jun 21, 2024
@plesetsk
Copy link

Same

1 similar comment
@peksuj
Copy link

peksuj commented Jun 24, 2024

Same

@acockburn
Copy link
Member

Where exactly did you specify Pandas to cause this? Was it in an app?

@MartijnAdriaanse
Copy link
Author

I used the GUI within HomeAssistant and a requirements.txt, both leading to the same error related to np.float64 / numpy 2.0.0. incompatibility.

The workaround, so far, completely resolves this issue for me. I specified numpy==1.26.4 in the HA GUI and installed and imported other packages (i.e. scipy and PuLP) without any issues so far.

@acockburn
Copy link
Member

Thanks for clarifying, and supplying the workaround. I'll leave this open for a while for other folks to see, I don't see that I can do anything to fix it. Numpy isn't an explicit requirement for AD, it seems to get pulled in by deepdiff, but if I add it to our requirements and pin it I might cause other issues later on when they fix it. Let me know if you see something different I can do to help.

@sjur-j
Copy link

sjur-j commented Jun 25, 2024

I use numpy extensively in appdeamon apps and get the same issue. Tried specifying an older version (numpy==1.26.4) in requirements.txt in the same directory as the appdeamon.yaml file, but this does not help.
Can you please advice on how I can use the suggested workaround?

@sjur-j
Copy link

sjur-j commented Jun 26, 2024

IMG_8106

@sjur-j
Copy link

sjur-j commented Jun 26, 2024

I finally figured out where to amend the config in the GUI. See picture in above post.
Everything is now working again.
Thanks for the tip!

@plesetsk
Copy link

Thanks!

@ahmadyusuf
Copy link

Thank you very much, I was looking into it for the last few days and couldn't figure out what made my sensors in HA stop working.
I used appDaemon as a docker container, specifying the numpy version in the requirements file fixed it as well.
I hope the developer will fix it in a future release and then we can revert back the work around.

@ahmadyusuf
Copy link

@acockburn

HASS plugin is using the DeepDiff module , which will install numpy as a dependency

appdaemon/plugins/hass/hassplugin.py -> Line 14 -> from deepdiff import DeepDiff

The DeepDiff module is using float_ which was removed in numpy 2.0 release, which caused it to break and hence , also break the HASS plugin

File "/usr/lib/python3.11/site-packages/deepdiff/helper.py", line 63

@ahmadyusuf
Copy link

mmm, I can see that it was fixed in the Deepdiff module 10 months ago, so probably our fix should by updating the Deepdiff version rather than downgrading the numpy version

seperman/deepdiff@a8f781d

@ahmadyusuf
Copy link

appDaemon is using deepdiff==6.3.0
NumPy 2.0 support was added in 6.6.0
The latest version is v 7.0.1

So we probably need to update to at least 6.6.0 to fix this isuse

@fboundy
Copy link

fboundy commented Aug 15, 2024

An alternative fix seems to be to specify deepdiff>7.0.0 in the appdaemon config. Appdaemon complains but loads OK

@acockburn
Copy link
Member

acockburn commented Aug 15, 2024 via email

@acockburn
Copy link
Member

OK, I bumped deepdiff to 7.0.1 in dev - can anyone let me know if this fixes the issue?

@acockburn acockburn added the work_in_progress Isse or PR that is evolving and shouldn't;t be aged out label Aug 20, 2024
@dekiesel
Copy link

Just wanted to mention that adding matplotlib also can lead to this error. Adding deepdiff>7.0.0 fixes the issue.

@acockburn
Copy link
Member

acockburn commented Sep 11, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working work_in_progress Isse or PR that is evolving and shouldn't;t be aged out
Projects
None yet
Development

No branches or pull requests

8 participants