Upgrade problems HA-Core venv 2023.3.6 to 2023.4.x/2023.5.x

Hi all!

I’m using HA-Core in a virtual environment (pip) ant want to upgrade HA from 2023.3.6 to any 2023.4.x version. It’s a Raspberry Pi 3 Model B+ with osmc (debian)

This fails because of the new cryptography version 40.0.1.
I get the following error.

I tried to upgrade a completely new venv to python 3.11 but when I install the requirements I get exactly the same error. I’m wondering, why the setup tries to unpack a win32 binary.

I also tried to upgrade the cryptography package alone to 40.0.2, but I get the same error.

Does someone have an idea?!
I can’t update HA anymore since 4 weeks.

Running `rustc --crate-name cryptography_rust --edition=2018 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type cdylib --emit=dep-info,link -C opt-level=3 -C lto=thin -C overflow-checks=on --cfg 'feature="default"' --cfg 'feature="extension-module"' -C metadata=2407ebcc60d88c97 --out-dir /tmp/pip-install-02nqsyh0/cryptography_bbc0284838224a90956b38f30f074441/src/rust/target/release/deps -L dependency=/tmp/pip-install-02nqsyh0/cryptography_bbc0284838224a90956b38f30f074441/src/rust/target/release/deps --extern asn1=/tmp/pip-install-02nqsyh0/cryptography_bbc0284838224a90956b38f30f074441/src/rust/target/release/deps/libasn1-1f36e558835be1e9.rlib --extern chrono=/tmp/pip-install-02nqsyh0/cryptography_bbc0284838224a90956b38f30f074441/src/rust/target/release/deps/libchrono-72a4a023d729740a.rlib --extern foreign_types_shared=/tmp/pip-install-02nqsyh0/cryptography_bbc0284838224a90956b38f30f074441/src/rust/target/release/deps/libforeign_types_shared-0533b1da914edb9d.rlib --extern once_cell=/tmp/pip-install-02nqsyh0/cryptography_bbc0284838224a90956b38f30f074441/src/rust/target/release/deps/libonce_cell-864698dbd75185fb.rlib --extern openssl=/tmp/pip-install-02nqsyh0/cryptography_bbc0284838224a90956b38f30f074441/src/rust/target/release/deps/libopenssl-c24ee10219eb2711.rlib --extern openssl_sys=/tmp/pip-install-02nqsyh0/cryptography_bbc0284838224a90956b38f30f074441/src/rust/target/release/deps/libopenssl_sys-de6aa823abab0d4e.rlib --extern ouroboros=/tmp/pip-install-02nqsyh0/cryptography_bbc0284838224a90956b38f30f074441/src/rust/target/release/deps/libouroboros-8c011bf66c430803.rlib --extern pem=/tmp/pip-install-02nqsyh0/cryptography_bbc0284838224a90956b38f30f074441/src/rust/target/release/deps/libpem-32861522e56a774a.rlib --extern pyo3=/tmp/pip-install-02nqsyh0/cryptography_bbc0284838224a90956b38f30f074441/src/rust/target/release/deps/libpyo3-5ae737da2b299080.rlib -L native=/tmp/pip-install-02nqsyh0/cryptography_bbc0284838224a90956b38f30f074441/src/rust/target/release/build/cryptography-rust-75f68e965953ec33/out -l static=_openssl.a --cfg 'python_implementation="CPython"'`
          Finished release [optimized] target(s) in 9m 26s
      error: failed to download `windows v0.46.0`

      Caused by:
        unable to get packages from source

      Caused by:
        failed to unpack package `windows v0.46.0`

      Caused by:
        failed to unpack entry at `windows-0.46.0/src/Windows/Win32/Graphics/Dxgi/mod.rs`

      Caused by:
        failed to unpack `/home/homeassistant/.cargo/registry/src/github.com-1285ae84e5963aae/windows-0.46.0/src/Windows/Win32/Graphics/Dxgi/mod.rs`

      Caused by:
        failed to unpack `windows-0.46.0/src/Windows/Win32/Graphics/Dxgi/mod.rs` into `/home/homeassistant/.cargo/registry/src/github.com-1285ae84e5963aae/windows-0.46.0/src/Windows/Win32/Graphics/Dxgi/mod.rs`

      Caused by:
        unexpected end of file

          =============================DEBUG ASSISTANCE=============================
          If you are seeing a compilation error please try the following steps to
          successfully install cryptography:
          1) Upgrade to the latest pip and try again. This will fix errors for most
             users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
          2) Read https://cryptography.io/en/latest/installation/ for specific
             instructions for your platform.
          3) Check our frequently asked questions for more information:
             https://cryptography.io/en/latest/faq/
          4) Ensure you have a recent Rust toolchain installed:
             https://cryptography.io/en/latest/installation/#rust

          Python: 3.10.9
          platform: Linux-5.10.78-7-osmc-armv7l-with-glibc2.31
          pip: n/a
          setuptools: 67.7.2
          setuptools_rust: 1.6.0
          rustc: n/a
          =============================DEBUG ASSISTANCE=============================

      error: `cargo metadata --manifest-path src/rust/Cargo.toml --format-version 1` failed with code 101
      -- Output captured from stdout:

      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for cryptography
Failed to build cryptography
ERROR: Could not build wheels for cryptography, which is required to install pyproject.toml-based projects

Hi
if I recall correctly I did remove rust at some point with
sudo apt-get remove rustc cargo
and re-install with
curl https://sh.rustup.rs 2 -sSf | sh

I believe it was related to cryptography and a minimum required rust version,
searching for the command to install, this thread is found, but as I wrote, I can’t recall the exact reason why I have done this… getting old perhaps …

When installing a new venv I always do a new install for HA, I never again use pip freeze to create a requirements file and process that in the new environment… did once and it didn’t work at all.

Armin

Thank you!

I already removed rust and reinstalled it with your command but same problem.

I’ll try to install a new venv now without requirements.txt.

Same problem, also with a new venv without requirements.txt:

 Caused by:
        unable to get packages from source

      Caused by:
        failed to unpack package `windows v0.46.0`

      Caused by:
        failed to unpack entry at `windows-0.46.0/src/Windows/Win32/Graphics/Dxgi/mod.rs`

      Caused by:
        failed to unpack `/home/homeassistant/.cargo/registry/src/github.com-1285ae84e5963aae/windows-0.46.0/src/Windows/Win32/Graphics/Dxgi/mod.rs`

      Caused by:
        failed to unpack `windows-0.46.0/src/Windows/Win32/Graphics/Dxgi/mod.rs` into `/home/homeassistant/.cargo/registry/src/github.com-1285ae84e5963aae/windows-0.46.0/src/Windows/Win32/Graphics/Dxgi/mod.rs`

      Caused by:
        unexpected end of file

          =============================DEBUG ASSISTANCE=============================
          If you are seeing a compilation error please try the following steps to
          successfully install cryptography:
          1) Upgrade to the latest pip and try again. This will fix errors for most
             users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
          2) Read https://cryptography.io/en/latest/installation/ for specific
             instructions for your platform.
          3) Check our frequently asked questions for more information:
             https://cryptography.io/en/latest/faq/
          4) Ensure you have a recent Rust toolchain installed:
             https://cryptography.io/en/latest/installation/#rust

          Python: 3.11.3
          platform: Linux-5.10.78-7-osmc-armv7l-with-glibc2.31
          pip: n/a
          setuptools: 67.7.2
          setuptools_rust: 1.6.0
          rustc: 1.69.0 (84c898d65 2023-04-16)
          =============================DEBUG ASSISTANCE=============================

      error: `cargo metadata --manifest-path src/rust/Cargo.toml --format-version 1` failed with code 101
      -- Output captured from stdout:

      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.

I don’t know what to do…
Why does the venv tries to unpack a windows package?!

Don’t know if that helps, but is your osmc up to date?

Doesn’t do that here, but I’m afraid I can’t help here, I have a Pi 4 with “standard” Raspberry Pi OS

perhaps explicitly selecting the build target? OSMC might install something where rust/cargo can’t correctly determine the target system and incorrectly selects Windows.

They talk about that here

Of course I just read it there, never tried myself… also not sure what you have to select as build target.

Armin

1 Like

Yes, it is.