mawinkler / astroweather

Asynchronous Astro Weather Forecast for Home Assistant
GNU General Public License v3.0
79 stars 9 forks source link

Getting error after upgrading to 2024.10.0 #62

Closed kaizersoje closed 1 month ago

kaizersoje commented 1 month ago

After upgrading to 2024.10.0, the integration is not getting loaded and am seeing these errors in the logs.

2024-10-03 17:48:17.685 ERROR (SyncWorker_5) [homeassistant.util.package] Unable to install package pyastroweatherio==0.60.3: error: Failed to prepare distributions
Caused by: Failed to fetch wheel: pyephem==9.99
Caused by: Failed to install requirements from `build-system.requires` (install)
Caused by: Failed to install build dependencies
Caused by: Failed to install: setuptools-75.1.0-py3-none-any.whl (setuptools==75.1.0)
Caused by: The wheel is invalid: metadata field Metadata-Version not found
2024-10-03 17:48:21.822 ERROR (SyncWorker_5) [homeassistant.util.package] Unable to install package pyastroweatherio==0.60.3: error: Failed to prepare distributions
Caused by: Failed to fetch wheel: pyastroweatherio==0.60.3
Caused by: Failed to install requirements from `build-system.requires` (install)
Caused by: Failed to install build dependencies
Caused by: Failed to install: setuptools-75.1.0-py3-none-any.whl (setuptools==75.1.0)
Caused by: The wheel is invalid: metadata field Metadata-Version not found
mawinkler commented 1 month ago

Hmmm, I just upgraded to 2024.10.0 and at least with the current main I'm running I don't get this error. Will check again before releasing a new version with some nice features from Uptonight.

kaizersoje commented 1 month ago

Still getting error after installing 0.61.0

Logger: homeassistant.util.package
Source: util/package.py:150
First occurred: 06:43:52 (6 occurrences)
Last logged: 06:44:27

Unable to install package pyastroweatherio==0.61.0: error: Failed to prepare distributions Caused by: Failed to fetch wheel: pyastroweatherio==0.61.0 Caused by: Failed to install requirements from `build-system.requires` (install) Caused by: Failed to install build dependencies Caused by: Failed to install: setuptools-75.1.0-py3-none-any.whl (setuptools==75.1.0) Caused by: The wheel is invalid: metadata field Metadata-Version not found
Unable to install package pyastroweatherio==0.61.0: error: Failed to prepare distributions Caused by: Failed to fetch wheel: pyephem==9.99 Caused by: Failed to install requirements from `build-system.requires` (install) Caused by: Failed to install build dependencies Caused by: Failed to install: setuptools-75.1.0-py3-none-any.whl (setuptools==75.1.0) Caused by: The wheel is invalid: metadata field Metadata-Version not found
Unable to install package icalevents!=0.1.28: error: Failed to install: icalendar-5.0.13-py3-none-any.whl (icalendar==5.0.13) Caused by: The wheel is invalid: metadata field Metadata-Version not found
mawinkler commented 1 month ago

I tested it again on 2024.10.1 and 2024.11.0.dev0 (fresh dev container) but cannot replicate your error.

kaizersoje commented 1 month ago

I have got HA OS installed on a RPi4. I have a similar issue with another integration. Raised issue for that as well.

Not sure if this is a core issue or not.

kaizersoje commented 1 month ago

After upgrading to 2024.10.1, the errors are different now

Logger: homeassistant.setup
Source: setup.py:334
First occurred: 17:21:47 (1 occurrences)
Last logged: 17:21:47

Setup failed for custom integration 'astroweather': Unable to import component: cannot import name 'FORECAST_TYPE_HOURLY' from 'pyastroweatherio' (/usr/local/lib/python3.12/site-packages/pyastroweatherio/__init__.py)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1007, in async_get_component
    comp = await self.hass.async_add_import_executor_job(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1067, in _get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/config/custom_components/astroweather/__init__.py", line 7, in <module>
    from pyastroweatherio import FORECAST_TYPE_HOURLY, AstroWeather
ImportError: cannot import name 'FORECAST_TYPE_HOURLY' from 'pyastroweatherio' (/usr/local/lib/python3.12/site-packages/pyastroweatherio/__init__.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 334, in _async_setup_component
    component = await integration.async_get_component()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1027, in async_get_component
    self._component_future.result()
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1019, in async_get_component
    comp = self._get_component()
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1067, in _get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/config/custom_components/astroweather/__init__.py", line 7, in <module>
    from pyastroweatherio import FORECAST_TYPE_HOURLY, AstroWeather
ImportError: cannot import name 'FORECAST_TYPE_HOURLY' from 'pyastroweatherio' (/usr/local/lib/python3.12/site-packages/pyastroweatherio/__init__.py)
mawinkler commented 1 month ago

Strange. I now tested the current version on

image

on amd64 (need to find a raspi ;-)) and it works as hoped.

I just built a pyastroweatherio for you to try. To test change the astroweather manifest to 0.60.0.2.

kaizersoje commented 1 month ago

Strange. I now tested the current version on image on amd64 (need to find a raspi ;-)) and it works as hoped.

I just built a pyastroweatherio for you to try. To test change the astroweather manifest to 0.60.0.2.

I changed the version of astroweather to 0.60.0.2. pyastroweatherio is still set to 0.61.0

2024-10-10 15:15:54.653 ERROR (SyncWorker_5) [homeassistant.util.package] Installed version for pyastroweatherio resolved to None

Logger: homeassistant.setup
Source: setup.py:334
First occurred: 15:16:18 (1 occurrences)
Last logged: 15:16:18

Setup failed for custom integration 'astroweather': Unable to import component: cannot import name 'FORECAST_TYPE_HOURLY' from 'pyastroweatherio' (/usr/local/lib/python3.12/site-packages/pyastroweatherio/__init__.py)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1007, in async_get_component
    comp = await self.hass.async_add_import_executor_job(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1067, in _get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/config/custom_components/astroweather/__init__.py", line 7, in <module>
    from pyastroweatherio import FORECAST_TYPE_HOURLY, AstroWeather
ImportError: cannot import name 'FORECAST_TYPE_HOURLY' from 'pyastroweatherio' (/usr/local/lib/python3.12/site-packages/pyastroweatherio/__init__.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 334, in _async_setup_component
    component = await integration.async_get_component()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1027, in async_get_component
    self._component_future.result()
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1019, in async_get_component
    comp = self._get_component()
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1067, in _get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/config/custom_components/astroweather/__init__.py", line 7, in <module>
    from pyastroweatherio import FORECAST_TYPE_HOURLY, AstroWeather
ImportError: cannot import name 'FORECAST_TYPE_HOURLY' from 'pyastroweatherio' (/usr/local/lib/python3.12/site-packages/pyastroweatherio/__init__.py)
mawinkler commented 1 month ago

Sorry, my fault, I was not precise enough. In the manifest of astroweather please set the versions as below:

    "requirements": [
        "pyastroweatherio==0.61.0.2"
    ],
    "version": "0.61.0"

This leaves astroweather at the current release version but changes the library to the updated one.

kaizersoje commented 1 month ago

I set this in the manifest as you mentioned.

    "requirements": [
        "pyastroweatherio==0.61.0.2"
    ],
    "version": "0.61.0"

Still getting the same error

Logger: homeassistant.setup
Source: setup.py:334
First occurred: 16:14:39 (1 occurrences)
Last logged: 16:14:39

Setup failed for custom integration 'astroweather': Unable to import component: cannot import name 'FORECAST_TYPE_HOURLY' from 'pyastroweatherio' (/usr/local/lib/python3.12/site-packages/pyastroweatherio/__init__.py)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1007, in async_get_component
    comp = await self.hass.async_add_import_executor_job(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1067, in _get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/config/custom_components/astroweather/__init__.py", line 7, in <module>
    from pyastroweatherio import FORECAST_TYPE_HOURLY, AstroWeather
ImportError: cannot import name 'FORECAST_TYPE_HOURLY' from 'pyastroweatherio' (/usr/local/lib/python3.12/site-packages/pyastroweatherio/__init__.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 334, in _async_setup_component
    component = await integration.async_get_component()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1027, in async_get_component
    self._component_future.result()
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1019, in async_get_component
    comp = self._get_component()
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1067, in _get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/config/custom_components/astroweather/__init__.py", line 7, in <module>
    from pyastroweatherio import FORECAST_TYPE_HOURLY, AstroWeather
ImportError: cannot import name 'FORECAST_TYPE_HOURLY' from 'pyastroweatherio' (/usr/local/lib/python3.12/site-packages/pyastroweatherio/__init__.py)

I restarted HA twice.

mawinkler commented 1 month ago

I released 0.61.1 which hopefully fixes your issues

kaizersoje commented 1 month ago

It works. If I may ask, what was the issue? I noticed a dew other intergrations have similar issue with the py libraries which are not getting resolved.

mawinkler commented 1 month ago

Of course you can. So the problem didn't exist on amd64, only on arm64. That's why I couldn't replicate it at first.

The logs you sent and the logs from issue #63 pointed me to the dependencies, especially on the setuptools package. I updated all of them to their current releases. This fixed your problem and and one of @0utc45t's.

There was still the problem with FORECAST_TYPE_HOURLY which I removed from the module imports and AstroWeather as I only do hourly forecasts.

The other problem in issue #63 was actually not relevant for this dependency issue here.

So in a nutshell, my guess is that the issue is caused by home assistant now using uv instead of pip and that there was an incompatibility with the quite outdated setuptools I was using in pyastroweatherio. But this is just a guess.

mawinkler commented 1 month ago

Fixed with 0.61.1