Dependency creep breaks usability

Just to set up a context: I have been using HA on Raspberry Pi 3B (and later 3B+) since 2017. I am not sure it was then defined as such, but today I believe it is called “core” distribution - i.e. I run it on Raspbian, in Python venv.

Since then I went through several OS upgrades, Python upgrades, and HA upgrades (with changing ZWave backend and what not) and it never was smooth, but somehow I managed. I run HA with some ZWave, Zigbee, BT devices and Philips HUE bridge with few bulbs. It is more a proof of concept setup since I do not do much automation around, just reading sensors and setting the thermostats and lights.

The last update to 2024.6.1 was by far the most difficult.

  1. HA suddenly needed ffmpeg. I do not run any camera, or process any video stream on RPi (It would not make much sense), but for some reason it is a hard dependency.
    This is what gets pulled in on my RPi by installing ffmpeg:
pi@hass:~ $ sudo apt install ffmpeg
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  fontconfig fontconfig-config fonts-dejavu-core libaacs0 libaom0 libass9 libasyncns0 libavc1394-0 libavcodec58
  libavdevice58 libavfilter7 libavformat58 libavresample4 libavutil56 libbdplus0 libblas3 libbluray2 libbs2b0 libcaca0
  libcairo-gobject2 libcairo2 libcdio-cdda2 libcdio-paranoia2 libcdio19 libchromaprint1 libcodec2-0.9 libdatrie1
  libdav1d4 libdc1394-25 libdrm-amdgpu1 libdrm-nouveau2 libdrm-radeon1 libepoxy0 libfftw3-double3 libflac8 libflite1
  libfontconfig1 libfribidi0 libgbm1 libgdk-pixbuf-2.0-0 libgdk-pixbuf2.0-bin libgdk-pixbuf2.0-common libgfortran5
  libgl1 libgl1-mesa-dri libglapi-mesa libglvnd0 libglx-mesa0 libglx0 libgme0 libgraphite2-3 libgsm1 libharfbuzz0b
  libiec61883-0 libjack-jackd2-0 liblapack3 liblilv-0-0 libllvm11 libmp3lame0 libmpg123-0 libmysofa1 libnorm1 libogg0
  libopenal-data libopenal1 libopenmpt0 libopus0 libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libpgm-5.3-0
  libpixman-1-0 libpocketsphinx3 libpostproc55 libpulse0 librabbitmq4 libraw1394-11 librsvg2-2 librsvg2-common
  librubberband2 libsdl2-2.0-0 libserd-0-0 libshine3 libsnappy1v5 libsndfile1 libsndio7.0 libsodium23 libsord-0-0
  libsoxr0 libspeex1 libsphinxbase3 libsratom-0-0 libsrt1.4-gnutls libssh-gcrypt-4 libswresample3 libswscale5
  libthai-data libthai0 libtheora0 libtwolame0 libudfread0 libva-drm2 libva-x11-2 libva2 libvdpau-va-gl1 libvdpau1
  libvidstab1.1 libvorbis0a libvorbisenc2 libvorbisfile3 libvpx6 libvulkan1 libwavpack1 libwayland-client0
  libwayland-cursor0 libwayland-egl1 libwayland-server0 libx11-xcb1 libx264-160 libx265-192 libxcb-dri2-0
  libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-randr0 libxcb-render0 libxcb-shape0 libxcb-shm0 libxcb-sync1
  libxcb-xfixes0 libxcursor1 libxdamage1 libxfixes3 libxi6 libxinerama1 libxkbcommon0 libxrandr2 libxrender1
  libxshmfence1 libxss1 libxv1 libxvidcore4 libxxf86vm1 libz3-4 libzmq5 libzvbi-common libzvbi0 mesa-va-drivers
  mesa-vdpau-drivers mesa-vulkan-drivers ocl-icd-libopencl1 pocketsphinx-en-us va-driver-all vdpau-driver-all
  x11-common
Suggested packages:
  ffmpeg-doc libbluray-bdj libfftw3-bin libfftw3-dev jackd2 libportaudio2 opus-tools pulseaudio libraw1394-doc
  librsvg2-bin xdg-utils serdi sndiod sordi speex opencl-icd nvidia-legacy-390xx-vdpau-driver
  nvidia-legacy-340xx-vdpau-driver
The following NEW packages will be installed:
  ffmpeg fontconfig fontconfig-config fonts-dejavu-core libaacs0 libaom0 libass9 libasyncns0 libavc1394-0 libavcodec58
  libavdevice58 libavfilter7 libavformat58 libavresample4 libavutil56 libbdplus0 libblas3 libbluray2 libbs2b0 libcaca0
  libcairo-gobject2 libcairo2 libcdio-cdda2 libcdio-paranoia2 libcdio19 libchromaprint1 libcodec2-0.9 libdatrie1
  libdav1d4 libdc1394-25 libdrm-amdgpu1 libdrm-nouveau2 libdrm-radeon1 libepoxy0 libfftw3-double3 libflac8 libflite1
  libfontconfig1 libfribidi0 libgbm1 libgdk-pixbuf-2.0-0 libgdk-pixbuf2.0-bin libgdk-pixbuf2.0-common libgfortran5
  libgl1 libgl1-mesa-dri libglapi-mesa libglvnd0 libglx-mesa0 libglx0 libgme0 libgraphite2-3 libgsm1 libharfbuzz0b
  libiec61883-0 libjack-jackd2-0 liblapack3 liblilv-0-0 libllvm11 libmp3lame0 libmpg123-0 libmysofa1 libnorm1 libogg0
  libopenal-data libopenal1 libopenmpt0 libopus0 libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libpgm-5.3-0
  libpixman-1-0 libpocketsphinx3 libpostproc55 libpulse0 librabbitmq4 libraw1394-11 librsvg2-2 librsvg2-common
  librubberband2 libsdl2-2.0-0 libserd-0-0 libshine3 libsnappy1v5 libsndfile1 libsndio7.0 libsodium23 libsord-0-0
  libsoxr0 libspeex1 libsphinxbase3 libsratom-0-0 libsrt1.4-gnutls libssh-gcrypt-4 libswresample3 libswscale5
  libthai-data libthai0 libtheora0 libtwolame0 libudfread0 libva-drm2 libva-x11-2 libva2 libvdpau-va-gl1 libvdpau1
  libvidstab1.1 libvorbis0a libvorbisenc2 libvorbisfile3 libvpx6 libvulkan1 libwavpack1 libwayland-client0
  libwayland-cursor0 libwayland-egl1 libwayland-server0 libx11-xcb1 libx264-160 libx265-192 libxcb-dri2-0
  libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-randr0 libxcb-render0 libxcb-shape0 libxcb-shm0 libxcb-sync1
  libxcb-xfixes0 libxcursor1 libxdamage1 libxfixes3 libxi6 libxinerama1 libxkbcommon0 libxrandr2 libxrender1
  libxshmfence1 libxss1 libxv1 libxvidcore4 libxxf86vm1 libz3-4 libzmq5 libzvbi-common libzvbi0 mesa-va-drivers
  mesa-vdpau-drivers mesa-vulkan-drivers ocl-icd-libopencl1 pocketsphinx-en-us va-driver-all vdpau-driver-all
  x11-common
0 upgraded, 156 newly installed, 0 to remove and 0 not upgraded.
Need to get 119 MB of archives.
After this operation, 332 MB of additional disk space will be used.

I guess no more words are necessary.
I have resolved that by pointing ffmpeg_bin to /bin/true as suggested by some post I found here.

  1. I was getting systematic error during start-up that TurboJPEG is not avaiable. Some post here suggested that installing libturbojpeg0 solved it on ubuntu, but even though the same lib is available on Raspbian, it did not seem to help.

  2. I was observing a partial initializations of the web GUI at every startup, until after quite a few restarts the GUI finally appeared to be fully working. But it was only an illusion.

Eventually I noticed that there are quite a few packages installed during startup. I believe this “lazy” installation was there ever since, this time however it was different.

First, HA was trying to pull packages which apparently did not exist in a binary dist, so pip happily run a build on them, and the build blocked the whole initialization.

Second, there seems to be some global timeout on this lazy install implementation, so since the requested package did take much more time to build, the whole install process eventually got stuck at some package, the GUI hung up in somewhat intermediate state and depending how far the lazy install went some integrations worked and some did not.

The next restart moved it a bit further, so one (or more) packages got compiled and installed, more GUI started to work and so on.

After 10+ restarts with inconsistent delays and non working GUI, I got what seems to be fully working HA with even TurboJPEG error being resolved (I would guess some dependency package did not get built until the very end).

While I was watching what was happening in htop I noticed that maybe 10+ mins of compilation during one restart took something with webrtc-audio-processing in its path. I do not know which package it was as the logging was scarce on what was happening during the install, but I again wonder.

I do not do any audio, so why did I need to build this package?

On the general note: Imagine that any “lazy” build during the HA startup runs on RPi with 1GB of RAM, while there is full HA process running, plus several node processes to host Zigbee and ZWave backends, plus mosquitto…

It may all sound pretty petty, but I remember that originally HA was very modular and configurable and stuff not mandatory was optional. What happened?

3 Likes

You probably have some integration installed that depends on ffmpeg. Try a new clean HA install and check whether it pulls ffmpeg, if it doesn’t, that would confirm the previous statement.

Just to clarify, the experience I described in the OP was during reinstalling HA from the scratch in a new venv, since I was moving from Python 3.10 to 3.12. So in a sense it was a clean install I just kept the configuration.

If, by clean install, you meant installing HA without any configuration - I did not do that (never do that actually). I guess my point was I had not changed anything in my setup during the reinstall. The same integrations just got moved into a new version of HA.

So you may be right, it might have happened because of some integration, but this does not change what I wrote.

Here is the list of the integrations I am currently using (and have been using before the reinstall):

I would consider those to be pretty basic/core integrations, none of which should justify sudden ffmpeg hard dependency.

Voice assistant stuff requires ffmpeg and is included by default, but that has been the case for like over a year already. Have you really not updated HA that long?

I guess, I might have not. I went from 2023.7 to 2024.6, IIRC. So how do I remove Voice assistant? It does not seem to be active on my setup.

Do you have default_config in your configuration.yaml? If so, then it includes voice assistant.