giaever-online-iot / home-assistant-snap

Snap recipe for the Open source home automation software that puts local control and privacy first.
Apache License 2.0
21 stars 3 forks source link

Missing dependencies "pyric" #17

Closed toledobastos closed 2 years ago

toledobastos commented 2 years ago

After updating Home Assistant Core to 2022.8.6 the integration ble_monitor cannot be installed due to missing dependencies "pyric." More details here:

https://github.com/custom-components/ble_monitor/issues/1005 https://github.com/custom-components/ble_monitor/issues/895

jmgiaever commented 2 years ago

Hi,

Thanks for the report. I'll look into it.

However, something really strange have happended within the snapcraft (build tool) and I'm not able to build a new version of HA at the moment.

It might just be a temporary bug, or a change on the transition to core22 which uses a different container.

I will probably spend time to port the project to core22 instead of wasting more time on this.

toledobastos commented 2 years ago

Brill. As you can see here I found a workaround to the problem. It's not ideal but it does fix the problem.

jmgiaever commented 2 years ago

Hi, I've now managed to fix the build issue; Latest buiild includes Python 3.10 (not 3.9) from repositories and not built from source. This should clear up the whole a bit. It's living in the latest/edge channel by now. I'm not sure if it's ready for the stable channels yet.

There's no errors upon build now, so there shouldn't be any missing packages. Can you verify?

You can switch with

sudo snap switch home-assistant-snap --channel=edge

if things crashes, you can roll back with

sudo snap revert home-assistant-snap && sudo snap switch home-assistant-snap --channel=latest

I've pushed the revision of 2022.08.6 to this channel. :)

Could you report back to me if you still have issues?

toledobastos commented 2 years ago

Nicely done. It installs fine on --channel=edge so hopefully it's sorted out now. But I can't tell for sure because the workaround I found entails manually copying the pyric library to the root library, so chances are the updated snap is still reading from this library instead of the Python 3.10 VENV that you repackaged now. Hope this makes sense.

toledobastos commented 2 years ago

Now I can see the update. Nope, it's not working. Updated at 2.14AM and broke the following integrations:

Invalid config The following integrations and platforms could not be set up:

ytube_music_player (Show logs) ble_monitor (Show logs) myenergi (Show logs) meross_cloud (Show logs) alexa_media (Show logs) hacs (Show logs) Please check your config and logs.

I reverted to 2022.8.6 and switched to latest/stable. Everything is working again.

jmgiaever commented 2 years ago

Hi,

Can you do a restart of the snap; HA will install requirements, and with the switch to 3.10, it will do that into a python3.10 directory.

HA will install them on the first start, but a restart is required to apply them.

sudo snap restart home-assistant-snap

(After first upgrade and that HA has started.)

toledobastos commented 2 years ago

Do you mean switching back to --channel=edge, and then restarting the snap? I'm back to latest/stable.

jmgiaever commented 2 years ago

All of these are HACS integrations and not bundled with the HA snap. So they will be re-installed on the switch, but after first boot.... And works as normal like when you've installed any HACS; a restart is required.

toledobastos commented 2 years ago

Gotcha. I reverted to --channel=edge, refreshed the snap, and then sudo snap restart home-assistant-snap. It took a while to start (presumably because it was installing dependencies), but it still didn't work. BLE_monitor and alexa_media could not be installed.

The following integrations and platforms could not be set up:

ble_monitor (Show logs) alexa_media (Show logs) Please check your config and logs.

I've have now reverted to --channel=latest where everything is working.

jmgiaever commented 2 years ago

Do you mean switching back to --channel=edge, and then restarting the snap? I'm back to latest/stable.

Indeed. But let it start up first, so it gets the chance to install everything first. Wait for the logging to rest (sudo snap logs home-assistant-snap -f) after startup.

Then

sudo snap restart home-assistant-snap

and possibly watch the logs on restart 😀

jmgiaever commented 2 years ago

[...] reverted to --channel=edge, refreshed the snap, and then sudo snap restart home-assistant-snap. It took a while to start (presumably because it was installing dependencies), but it still didn't work.

But did you let it restart fully after the installation, before you restarted?

If you just did a quick restart and waited for it to boot up, then it will continue to install dependencies on the second restart and you have do to an additional restart.

And it seems to me that it just got halfway through the installation before the restart happened, since some of the integrations was back up running.

Python can't load packages that got installed after launch. You have to start the application and let HA handle the re-install of packages, then do the restart.

My suggestion is to

  1. Switch to edge and update. This will also restart the snap.
  2. Check logs and wait HA to settle/rest, after the start. But then also give it a few more minutes, as installation can still happen behind the scene.
  3. Do the restart
  4. Watch the logs.

I've multiple integrations + HACS and custom integrations. All of them are working.