Unable to install Nest integration on Home Assistant Core (google-nest-sdm)

Yesterday I decided to switch my Raspberry Pi 4 from buster to bulleye.
I then installed the new operating system on a new sd card and after installing Home Assistant Core I realized that the Nest integration was not working.
I therefore decided to do a fresh installation of Core with a clean configuration file to eliminate possible conflicts and to be able to better read the log file.
The problem appears to be related to rustc / cargo compiling the “libcst” library.
I tried to install bulleye on a Raspberry Pi 3b too, but the result was the same.
All tests were carried out with Home Assistant Core 2021.12.10.
I also tried to install libcst directly with pip, but the compilation always stops.
The tests were done with both the official bulleye rustc package and the manual installation (“curl --proto ‘= https’ --tlsv1.2 -sSf https://sh.rustup.rs | sh”) .
After countless attempts, I couldn’t figure it out.
Below is the installation log:

2022-01-23 08:14:37 ERROR (SyncWorker_3) [homeassistant.util.package] Unable to install package google-nest-sdm==0.4.9: ERROR: Command errored out with exit status 1:
   command: /srv/homeassistant/bin/python3.9 /srv/homeassistant/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmp5qtll_02
       cwd: /tmp/pip-install-9gq7wbtl/libcst
  Complete output (419 lines):
  ...
  
  ...

     Compiling libcst v0.1.0 (/tmp/pip-install-9gq7wbtl/libcst/native/libcst)
       Running `rustc --crate-name libcst_native --edition=2018 libcst/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type cdylib --crate-type rlib --emit=dep-info,link -C opt-level=3 -Cembed-bitcode=no --crate-type cdylib --cfg 'feature="default"' -C metadata=652054040f09fe98 --out-dir /tmp/pip-install-9gq7wbtl/libcst/native/target/release/deps -L dependency=/tmp/pip-install-9gq7wbtl/libcst/native/target/release/deps --extern chic=/tmp/pip-install-9gq7wbtl/libcst/native/target/release/deps/libchic-b8f6abd9baa55c18.rlib --extern itertools=/tmp/pip-install-9gq7wbtl/libcst/native/target/release/deps/libitertools-d71849f56d81c638.rlib --extern libcst_derive=/tmp/pip-install-9gq7wbtl/libcst/native/target/release/deps/liblibcst_derive-657f36087bfbd1f9.so --extern once_cell=/tmp/pip-install-9gq7wbtl/libcst/native/target/release/deps/libonce_cell-afa4fce135686c24.rlib --extern paste=/tmp/pip-install-9gq7wbtl/libcst/native/target/release/deps/libpaste-4d37a7c78de6fe6f.so --extern peg=/tmp/pip-install-9gq7wbtl/libcst/native/target/release/deps/libpeg-8dc7507a03b678a5.rlib --extern pyo3=/tmp/pip-install-9gq7wbtl/libcst/native/target/release/deps/libpyo3-98ce5ebd790580fe.rlib --extern regex=/tmp/pip-install-9gq7wbtl/libcst/native/target/release/deps/libregex-24b6fd23a6579ee9.rlib --extern thiserror=/tmp/pip-install-9gq7wbtl/libcst/native/target/release/deps/libthiserror-3d9b7581a7ecde1f.rlib`
  error[E0658]: or-patterns syntax is experimental
      --> libcst/src/parser/grammar.rs:3413:14
       |
  3413 |         e @ (Expression::Integer(_) | Expression::Float(_)) => Ok(e),
       |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
       = note: see issue #54883 <https://github.com/rust-lang/rust/issues/54883> for more information

  error[E0658]: use of unstable library feature 'split_inclusive'
    --> libcst/src/tokenizer/whitespace_parser.rs:84:26
     |
  84 |             lines: input.split_inclusive(default_newline).collect(),
     |                          ^^^^^^^^^^^^^^^
     |
     = note: see issue #72360 <https://github.com/rust-lang/rust/issues/72360> for more information

  error: aborting due to 2 previous errors

  For more information about this error, try `rustc --explain E0658`.
  error: could not compile `libcst`.

  Caused by:
    process didn't exit successfully: `rustc --crate-name libcst_native --edition=2018 libcst/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type cdylib --crate-type rlib --emit=dep-info,link -C opt-level=3 -Cembed-bitcode=no --crate-type cdylib --cfg 'feature="default"' -C metadata=652054040f09fe98 --out-dir /tmp/pip-install-9gq7wbtl/libcst/native/target/release/deps -L dependency=/tmp/pip-install-9gq7wbtl/libcst/native/target/release/deps --extern chic=/tmp/pip-install-9gq7wbtl/libcst/native/target/release/deps/libchic-b8f6abd9baa55c18.rlib --extern itertools=/tmp/pip-install-9gq7wbtl/libcst/native/target/release/deps/libitertools-d71849f56d81c638.rlib --extern libcst_derive=/tmp/pip-install-9gq7wbtl/libcst/native/target/release/deps/liblibcst_derive-657f36087bfbd1f9.so --extern once_cell=/tmp/pip-install-9gq7wbtl/libcst/native/target/release/deps/libonce_cell-afa4fce135686c24.rlib --extern paste=/tmp/pip-install-9gq7wbtl/libcst/native/target/release/deps/libpaste-4d37a7c78de6fe6f.so --extern peg=/tmp/pip-install-9gq7wbtl/libcst/native/target/release/deps/libpeg-8dc7507a03b678a5.rlib --extern pyo3=/tmp/pip-install-9gq7wbtl/libcst/native/target/release/deps/libpyo3-98ce5ebd790580fe.rlib --extern regex=/tmp/pip-install-9gq7wbtl/libcst/native/target/release/deps/libregex-24b6fd23a6579ee9.rlib --extern thiserror=/tmp/pip-install-9gq7wbtl/libcst/native/target/release/deps/libthiserror-3d9b7581a7ecde1f.rlib` (exit code: 1)
  error: cargo failed with code: 101

  ----------------------------------------
  ERROR: Failed building wheel for libcst
ERROR: Could not build wheels for libcst which use PEP 517 and cannot be installed directly
WARNING: You are using pip version 20.2.4; however, version 21.3.1 is available.
You should consider upgrading via the '/srv/homeassistant/bin/python3.9 -m pip install --upgrade pip' command.
2022-01-23 08:29:21 ERROR (MainThread) [homeassistant.setup] Setup failed for nest: Requirements for nest not found: ['google-nest-sdm==0.4.9'].

I had the same issue just recently, turning on debug in the config, I found that an issue was occurring with the google_nest_adm package along with what you caught. I went to my older backup of the previous install and copied the /srv/homeassistant/lib/python3.9/site-packages/google* , libcst* files over along with libcst folder and rerunning the integration. I may have also installed the rust compiler, but not sure if this is actually needed when the other actions. By no means is the a solve all, but was a work around.

Thanks for sharing your solution. Using this work around, however, would cause me anxiety about a possible update of google-nest-sdm or libcst in future releases of Home Assistant, which would most likely cause the problem to recur.
The only stable solution I found on bulleye was to use the installation in docker, this way no problem arises.
However, since it is not the type of solution suitable for my needs, at the moment I preferred to go back to debian buster, waiting to find a definitive solution for bulleye.
I will continue to do some tests on a second raspberry pi 4 to see if I can manage it.

I agree, I switched to OS to rebuild my Raspberry Pi 4 since I wasn’t doing much that can’t be done there and it worked without any workarounds. It appears to be with the latest patches by the Raspberry team, as I tested on the available images for buster and bullseye in 32/64 full and lite version and Python version 3.9.2, 3.9.5, 3.10.2, with version of HA 2021.12.1, .9, .10, and dev with and without pre patching. All had the same errors. Hopefully there is a winning combination or a patch to correct it by either HA or Raspberry team.

I suspect the problem here is related to building grpcio – which is stuck to a very old version in home assistant, which I have been fixing and should be included in the next release. When we get home assistant running on a modern grpc, you likely should be able to install grpc from a binary wheel, hopefully. The problem is the grpcio wheels were built before python 3.9 was supported for example.

In the mean time… since you’re talking about hacking things, you can likely edit package_constraints.txt and remove the grpc stuff and pip3 install grpcio-1.43.0.

Unable to upgrade grpcio to newer versions due to armv7 link error · Issue #56669 · home-assistant/core · GitHub has more context.

Happy to help you hack through this or you can try the beta in a few days.

1 Like

I removed grpcio from the package_constraints.txt file and installed grpcio-1.43.0 via pip3. Unfortunately, compiling libcst always fails in the same place. Trying to install libcst via pip3 the result is the same, rustc / cargo fail to compile.
As further proof, I created a venv environment in which I installed wheel and then libcst-0.4.0 via pip3. Also in this case the compilation stops at the same point (the same in the first post).

Ok I was thinking it might somehow skip that dependency if installing from a wheel. Does libcst dep come from pip install or after? I haven’t looked yet but curious what depends on libcst exactly

running ‘pip3 install libcst’ starts the compilation with rustc (on my raspberry pi 4 takes about 15 minutes) which fails on ‘libcst / src / parser / grammar.rs’ and ‘libcst / src / tokenizer / whitespace_parser.rs’.

Honestly I don’t know why google-nest-sdm depends on this library, I’ll try to understand why with the same Python version (3.9.5) on bullseys the compilation fails, while on Buster it works.

It looks like it comes from google cloud pubsub.

$ pip3 install pipdeptree
$ pipdeptree -p libcst

Warning!!! Possibly conflicting dependencies found:

* google-cloud-pubsub==2.9.0

- libcst [required: >=0.3.10, installed: ?]

Which is defined here python-pubsub/setup.py at ef7703fe739380d0d58f18bc220a4996bdd5eed8 · googleapis/python-pubsub · GitHub

You may want to try manually setting different versions of libcst e.g. pip3 install libcst==0.4.0 from libcst · PyPI

Nothing to do, I had already tried to install previous versions, but the compilation fails.

(test) [email protected]:/srv/test $ pip3 install libcst==0.4.0
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting libcst==0.4.0
  Using cached libcst-0.4.0.tar.gz (702 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
    Preparing wheel metadata ... done
Collecting pyyaml>=5.2
  Using cached https://www.piwheels.org/simple/pyyaml/PyYAML-6.0-cp39-cp39-linux_armv7l.whl (45 kB)
Collecting typing-inspect>=0.4.0
  Using cached https://www.piwheels.org/simple/typing-inspect/typing_inspect-0.7.1-py3-none-any.whl (8.4 kB)
Collecting typing-extensions>=3.7.4.2
  Using cached https://www.piwheels.org/simple/typing-extensions/typing_extensions-4.0.1-py3-none-any.whl (22 kB)
Collecting mypy-extensions>=0.3.0
  Using cached https://www.piwheels.org/simple/mypy-extensions/mypy_extensions-0.4.3-py2.py3-none-any.whl (4.5 kB)
Building wheels for collected packages: libcst
  Building wheel for libcst (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: /srv/test/bin/python3.9 /srv/test/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py buil                                                                             d_wheel /tmp/tmpvvkglbhr
       cwd: /tmp/pip-install-kc8r_pl2/libcst_f1e3ee5902c04c93ae482b2b2be09e9e
  Complete output (419 lines):

-----

     Compiling libcst v0.1.0 (/tmp/pip-install-kc8r_pl2/libcst_f1e3ee5902c04c93ae482b2b2be09e9e/native/libcst)
       Running `rustc --crate-name libcst_native --edition=2018 libcst/src/lib.rs --error-format=json --json=diagnostic-ren                                                                             dered-ansi --crate-type cdylib --crate-type rlib --emit=dep-info,link -C opt-level=3 -Cembed-bitcode=no --crate-type cdylib                                                                              --cfg 'feature="default"' -C metadata=652054040f09fe98 --out-dir /tmp/pip-install-kc8r_pl2/libcst_f1e3ee5902c04c93ae482b2b                                                                             2be09e9e/native/target/release/deps -L dependency=/tmp/pip-install-kc8r_pl2/libcst_f1e3ee5902c04c93ae482b2b2be09e9e/native/                                                                             target/release/deps --extern chic=/tmp/pip-install-kc8r_pl2/libcst_f1e3ee5902c04c93ae482b2b2be09e9e/native/target/release/d                                                                             eps/libchic-b8f6abd9baa55c18.rlib --extern itertools=/tmp/pip-install-kc8r_pl2/libcst_f1e3ee5902c04c93ae482b2b2be09e9e/nati                                                                             ve/target/release/deps/libitertools-d71849f56d81c638.rlib --extern libcst_derive=/tmp/pip-install-kc8r_pl2/libcst_f1e3ee590                                                                             2c04c93ae482b2b2be09e9e/native/target/release/deps/liblibcst_derive-657f36087bfbd1f9.so --extern once_cell=/tmp/pip-install                                                                             -kc8r_pl2/libcst_f1e3ee5902c04c93ae482b2b2be09e9e/native/target/release/deps/libonce_cell-afa4fce135686c24.rlib --extern pa                                                                             ste=/tmp/pip-install-kc8r_pl2/libcst_f1e3ee5902c04c93ae482b2b2be09e9e/native/target/release/deps/libpaste-4d37a7c78de6fe6f.                                                                             so --extern peg=/tmp/pip-install-kc8r_pl2/libcst_f1e3ee5902c04c93ae482b2b2be09e9e/native/target/release/deps/libpeg-8dc7507                                                                             a03b678a5.rlib --extern pyo3=/tmp/pip-install-kc8r_pl2/libcst_f1e3ee5902c04c93ae482b2b2be09e9e/native/target/release/deps/l                                                                             ibpyo3-98ce5ebd790580fe.rlib --extern regex=/tmp/pip-install-kc8r_pl2/libcst_f1e3ee5902c04c93ae482b2b2be09e9e/native/target                                                                             /release/deps/libregex-24b6fd23a6579ee9.rlib --extern thiserror=/tmp/pip-install-kc8r_pl2/libcst_f1e3ee5902c04c93ae482b2b2b                                                                             e09e9e/native/target/release/deps/libthiserror-3d9b7581a7ecde1f.rlib`
  error[E0658]: or-patterns syntax is experimental
      --> libcst/src/parser/grammar.rs:3413:14
       |
  3413 |         e @ (Expression::Integer(_) | Expression::Float(_)) => Ok(e),
       |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
       = note: see issue #54883 <https://github.com/rust-lang/rust/issues/54883> for more information

  error[E0658]: use of unstable library feature 'split_inclusive'
    --> libcst/src/tokenizer/whitespace_parser.rs:84:26
     |
  84 |             lines: input.split_inclusive(default_newline).collect(),
     |                          ^^^^^^^^^^^^^^^
     |
     = note: see issue #72360 <https://github.com/rust-lang/rust/issues/72360> for more information

  error: aborting due to 2 previous errors

  For more information about this error, try `rustc --explain E0658`.
  error: could not compile `libcst`.

  Caused by:
    process didn't exit successfully: `rustc --crate-name libcst_native --edition=2018 libcst/src/lib.rs --error-format=jso                                                                             n --json=diagnostic-rendered-ansi --crate-type cdylib --crate-type rlib --emit=dep-info,link -C opt-level=3 -Cembed-bitcode                                                                             =no --crate-type cdylib --cfg 'feature="default"' -C metadata=652054040f09fe98 --out-dir /tmp/pip-install-kc8r_pl2/libcst_f                                                                             1e3ee5902c04c93ae482b2b2be09e9e/native/target/release/deps -L dependency=/tmp/pip-install-kc8r_pl2/libcst_f1e3ee5902c04c93a                                                                             e482b2b2be09e9e/native/target/release/deps --extern chic=/tmp/pip-install-kc8r_pl2/libcst_f1e3ee5902c04c93ae482b2b2be09e9e/                                                                             native/target/release/deps/libchic-b8f6abd9baa55c18.rlib --extern itertools=/tmp/pip-install-kc8r_pl2/libcst_f1e3ee5902c04c                                                                             93ae482b2b2be09e9e/native/target/release/deps/libitertools-d71849f56d81c638.rlib --extern libcst_derive=/tmp/pip-install-kc                                                                             8r_pl2/libcst_f1e3ee5902c04c93ae482b2b2be09e9e/native/target/release/deps/liblibcst_derive-657f36087bfbd1f9.so --extern onc                                                                             e_cell=/tmp/pip-install-kc8r_pl2/libcst_f1e3ee5902c04c93ae482b2b2be09e9e/native/target/release/deps/libonce_cell-afa4fce135                                                                             686c24.rlib --extern paste=/tmp/pip-install-kc8r_pl2/libcst_f1e3ee5902c04c93ae482b2b2be09e9e/native/target/release/deps/lib                                                                             paste-4d37a7c78de6fe6f.so --extern peg=/tmp/pip-install-kc8r_pl2/libcst_f1e3ee5902c04c93ae482b2b2be09e9e/native/target/rele                                                                             ase/deps/libpeg-8dc7507a03b678a5.rlib --extern pyo3=/tmp/pip-install-kc8r_pl2/libcst_f1e3ee5902c04c93ae482b2b2be09e9e/nativ                                                                             e/target/release/deps/libpyo3-98ce5ebd790580fe.rlib --extern regex=/tmp/pip-install-kc8r_pl2/libcst_f1e3ee5902c04c93ae482b2                                                                             b2be09e9e/native/target/release/deps/libregex-24b6fd23a6579ee9.rlib --extern thiserror=/tmp/pip-install-kc8r_pl2/libcst_f1e                                                                             3ee5902c04c93ae482b2b2be09e9e/native/target/release/deps/libthiserror-3d9b7581a7ecde1f.rlib` (exit code: 1)
  error: cargo failed with code: 101

  ----------------------------------------
  ERROR: Failed building wheel for libcst
Failed to build libcst
ERROR: Could not build wheels for libcst which use PEP 517 and cannot be installed directly

What i’m suggesting is trying prior versions of libcst e.g. 0.3.23 which doesn’t include that new code.

(That code was added in Implement a Python PEG parser in Rust by zsol · Pull Request #566 · Instagram/LibCST · GitHub merged in December and 0.3.32 is from November.)

Getting error[E0658]: use of unstable library feature 'assoc_char_consts': recently added and error[E0658]: or-patterns syntax is experimental error - #6 by alice - help - The Rust Programming Language Forum also suggests that you may have multiple copies of rust installed. Maybe pip is finding an older version than the one you additionally installed.

Currently I only have one version of rustc installed, the one present in the bullseye repositories. libcst 0.3.23 installation via pip3 is successful, without rustc compiling anything. I also installed google-nest-sdm without any problems. But when I start home assistant, try again to install the latest version of libcst to start google-nest-sdm, failing to compile

Looks like the next home assistant release pins libcst to a lower version in package_conatraints.txt

So I’d suggest copying that pin to get unstuxk since we’ve confirmed that version works for you.

I modified package_constraints.txt and gen_requirements_all.py by copying the grpcio and libcst pin. Now I have no compilation errors, but the integration is not working anyway I report the log below:

2022-01-25 17:46:41 ERROR (MainThread) [homeassistant.setup] Setup failed for nest: Unable to import component: /lib/arm-linux-gnueabihf/libc.so.6: version `GLIBC_2.33' not found (required by /srv/homeassistant/lib/python3.9/site-packages/grpc/_cython/cygrpc.cpython-39-arm-linux-gnueabihf.so)

ERROR: Command errored out with exit status 1: /srv/homeassistant/bin/python3.9 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-gweqse1v/rpi-gpio/setup.py'"'"'; __file__='"'"'/tmp/pip-install-gweqse1v/rpi-gpio/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-btdgey5k/install-record.txt --single-version-externally-managed --compile --install-headers /srv/homeassistant/include/site/python3.9/RPi.GPIO Check the logs for full command output.

WARNING: You are using pip version 20.2.4; however, version 21.3.1 is available.
You should consider upgrading via the '/srv/homeassistant/bin/python3.9 -m pip install --upgrade pip' command.
2022-01-25 17:50:01 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/data_entry_flow.py", line 203, in async_init
    flow, result = await task
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/data_entry_flow.py", line 221, in _async_init
    flow = await self.async_create_flow(handler, context=context, data=data)
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/config_entries.py", line 715, in async_create_flow
    await async_process_deps_reqs(self.hass, self._hass_config, integration)
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/setup.py", line 353, in async_process_deps_reqs
    await requirements.async_get_integration_with_requirements(
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/requirements.py", line 85, in async_get_integration_with_requirements
    await _async_process_integration(hass, integration, done)
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/requirements.py", line 101, in _async_process_integration
    await async_process_requirements(
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/requirements.py", line 164, in async_process_requirements
    await _async_process_requirements(
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/requirements.py", line 196, in _async_process_requirements
    raise RequirementsNotFound(name, [req])
homeassistant.requirements.RequirementsNotFound: Requirements for zha not found: ['zigpy-zigate==0.7.3'].

I should probably check the pins of other packages, but at this point I will wait for the next stable release to make other attempts, February is near.
Thank you so much for the support

Unfortunately still `GLIBC_2.33’ not found after installing 2022.2.8 and the Nest SDM and Google Home integration are broken.

You need to rebuild grpc from source, get the surce here: https://github.com/grpc/grpc/releases

Edit: I wasn’t aware of the other thread, I’ll post what I did to get the Nest integration working over there

@BernieV I saw you also posted on https://github.com/home-assistant/core/issues/65837 – i think that is a better place to keep the conversation going, with the folks with expertise who got this working.

I personally solved it by installing the 64-bit version of the Raspberry Pi OS. No compilation problems and everything works on the first try.