ERROR: Failed building wheel for cryptography

Same problem even after upgrade rust. My log.
rustc 1.57.0

Hi,

for armv7 during the cargo and rustc installation

curl https://sh.rustup.rs -sSf | sh

please first select option 2 and chage it to “armv7-unknown-linux-gnueabihf”, rest just enter defaults and then select option 1 and install. After that type:

source $HOME/.cargo/env

To double check if it is ok, just type

rustc – version

to see if it is OK.

Then run again installation of HA and the Cryptography should be properly built.

Good luck :wink:

P.S. be sure to unistall previous version via:

sudo apt remove rustc cargo

If you need to unistall previous cargo and rustc, use:

rustup self uninstall

3 Likes

Hi,

I found a workaround on one the debian bug reports. I seams to be a second bug with rust and git. If I set the following variables I was able to install the required cryptography 35.0.0 package:

export CRYPTOGRAPHY_DONT_BUILD_RUST=1
export CARGO_NET_GIT_FETCH_WITH_CLI=true

Christopher

Hi, should I update Rust in pip env or in my main account? I updated as a root user but in pip env HA says me: error: can’t find Rust compiler

EDIT
Helped me adding
export PATH=$PATH:~/.cargo/bin
after instalation of Rush from
curl [https://sh.rustup.rs](https://sh.rustup.rs/) -sSf | sh

This did it for me! Running
rustup self uninstall
first was important.

I’m on a raspberry pi. To make sure I was on an ARMv7 processor architecture I ran:

cat /proc/cpuinfo

1 Like

yet another similar, but slightly different issue:

cryptography==35 on a Pi 3b, with Rust installed via rustup, the command rustc -vV states that my platform is armv7-unknown-linux-gnueabihf – however, cryptography wants to use arm-unknown-linux-gnueabihf, which must be installed separately.

I used:

  • install rust locally via rustup, and make sure it’s on the path
  • rustup target add arm-unknown-linux-gnueabihf
  • Incidentally, I am also using a system with two python versions installed, and needed to export PYO3_CROSS_PYTHON_VERSION=3.8

…this finally worked.

1 Like

Hi, new version HA and still the same:
error: can’t find Rust compiler

I’ve instaled from curl https://sh.rustup.rs -sSf | sh, set source $HOME/.cargo/env

and nothing change. Why with each a new version of HA is the same problem?

same here! everyone has a hint how to do but what is the official straightforward way to upgrade to 2022.11.xx?
solution can’t be so tricky :frowning:

same here! 2022.11.2

On RPi 4 (Raspbian GNU/Linux 11 (bullseye)) :
sudo apt install rustc

And then
pip install --upgrade pip (if not already done)
pip install --upgrade homeassistant

It worked for me (be careful, it’s very long…)

2 Likes

is this done with the pi login or where?

this does not work On RPi 4 (Raspbian GNU/Linux 11 (bullseye)) :
sudo apt install rustc

And then
pip install --upgrade pip (if not already done)
pip install --upgrade homeassistant

It worked for me (be careful, it’s very long…)

I try to give step by step instructions never could figure out why people have to be so cryptic on the steps they used to make something work

if this works :wink: you can sudo apt install rustc as any user, but the pip stuff you have to do inside your home assistant virtual environment if you are a core guy

That’s what I thought but it didn’t work this why I asked

Anyone find a solution for the cryptography problem? I tried to follow the recommendations in this thread, but no luck. I reinstalled rust and also tried to follow the description in Installation — Cryptography 39.0.0.dev1 documentation but still get the same error message:
Building wheel for cryptography (pyproject.toml) did not run successfully…
The cargo build seems to start, but at the end it fails here:

Caused by:
process didn’t exit successfully: rustc --crate-name cryptography_rust --edition=2018 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type cdylib --emit=dep-info,link -C opt-level=3 -C lto=thin --crate-type cdylib -C overflow-checks=on --cfg 'feature="default"' --cfg 'feature="extension-module"' -C metadata=00452e0f91e94e19 --out-dir /tmp/pip-install-t8wcez__/cryptography_75eb470902364bbea01c68cdf899ec6c/src/rust/target/release/deps -L dependency=/tmp/pip-install-t8wcez__/cryptography_75eb470902364bbea01c68cdf899ec6c/src/rust/target/release/deps --extern asn1=/tmp/pip-install-t8wcez__/cryptography_75eb470902364bbea01c68cdf899ec6c/src/rust/target/release/deps/libasn1-542eab56166b85cc.rlib --extern chrono=/tmp/pip-install-t8wcez__/cryptography_75eb470902364bbea01c68cdf899ec6c/src/rust/target/release/deps/libchrono-07098687f402cd86.rlib --extern once_cell=/tmp/pip-install-t8wcez__/cryptography_75eb470902364bbea01c68cdf899ec6c/src/rust/target/release/deps/libonce_cell-2531e1844ca1f493.rlib --extern ouroboros=/tmp/pip-install-t8wcez__/cryptography_75eb470902364bbea01c68cdf899ec6c/src/rust/target/release/deps/libouroboros-f90c63d49e9f5ded.rlib --extern pem=/tmp/pip-install-t8wcez__/cryptography_75eb470902364bbea01c68cdf899ec6c/src/rust/target/release/deps/libpem-8cccd76f7bd027a3.rlib --extern pyo3=/tmp/pip-install-t8wcez__/cryptography_75eb470902364bbea01c68cdf899ec6c/src/rust/target/release/deps/libpyo3-6c7e61c8d5fbe332.rlib (exit status: 101)
LLVM ERROR: Invalid abbrev number
error: could not compile cryptography-rust

I’m on Raspberry 3 with HA Core. Do not understand why I have to compile this lib at all, is there a version which can be downloaded somewhere?

I’m on Raspberry 3 with HA Core 2022.11.4

Trobleshooting

ERROR: Failed building wheel for cryptography

#install Rust

curl https://sh.rustup.rs -sSf | sh

sudo apt -y install rustc

pip3 install pyOpenSSL --upgrade

1 Like

Thanks for the tip. Did the upgrade for pyOpenSSL

Successfully uninstalled pyOpenSSL-22.0.0
Successfully installed pyOpenSSL-22.1.0

But still the same error during upgrade of HA
Here is my HA environment reported from the build error

Python: 3.9.11
platform: Linux-5.10.103-v7±armv7l-with-glibc2.28
pip: n/a
setuptools: 65.6.0
setuptools_rust: 1.5.2
rustc: n/a

Error is still
LLVM ERROR: Invalid abbrev number
error: could not compile `cryptography-rust

After that I’ve installed a new version of HA

curl https://sh.rustup.rs  -sSf | sh
source $HOME/.cargo/env

What a ride to do the update to 2022.11.4. Again, I learned a lot about the settings and which libraries are important. What did actually work and Raspberry 3 with HA Core

Switch to the HA environment

  • sudo -u homeassistant -H -s
  • cd /srv/homeassistant/venv_3.9.11 (change this to your current path of HA installation)
  • python3.9 -m venv .
  • source bin/activate

Then I executed the followint steps to make sure the update works correctly

  • pip install --upgrade pip
  • pip3 install pyOpenSSL --upgrade
  • pip install --upgrade wheel
  • pip install --upgrade numpy (see description later)
  • rustup update (make sure to do this in the HA environment, this was the major problem for my installation)
  • check version with rustc --version
  • My version was stable-armv7-unknown-linux-gnueabihf updated - rustc 1.65.0 which worked at the end
  • pip install --upgrade cryptography (this did not work with my previous rustc version → Successfully installed cryptography-38.0.3)
  • pip3 install --upgrade homeassistant
  • reboot system

After the reboot the initial start of the HA environment version 2022.11.4 created a lot of errors. E.g. MQTT integration did not work, many config files generated errors. I did a config file check (under Developer Tools) and it reported the following error:

Component error: mqtt - IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE! Importing the numpy C-extensions failed. This error can happen for many reasons, often due to issues with your setup or how NumPy was installed. We have compiled some common reasons and troubleshooting tips at: https://numpy.org/devdocs/user/troubleshooting-importerror.html Please note and check the following: * The Python version is: Python3.9 from "/srv/homeassistant/venv_3.9.11/bin/python3.9" * The NumPy version is: "1.23.5" and make sure that they are the versions you expect. Please carefully study the documentation linked above for further help. Original error was: /lib/arm-linux-gnueabihf/libm.so.6: version `GLIBC_2.29' not found (required by /srv/homeassistant/venv_3.9.11/lib/python3.9/site-packages/numpy/core/_multiarray_umath.cpython-39-arm-linux-gnueabihf.so)

So even I had updated the numpy lib something is still wrong. I used tips from here Installing Home Assistant Core on Raspberry Pi 3B+ step by step (2022.11.2) | and here System cannot restart after update to 2022.10.2 - #2 by pck to do the following:

  • With the pi login: sudo apt-get install libatlas-base-dev
  • In the HA environment: pip3 install numpy --global-option="-mfloat-abi=hard" --force-reinstall
  • Reboot

At the end this worked, and the system comes back with all integrations, especially MQTT. Hope this helps others to succeed the Home Assistant Update adventures

4 Likes

this helped, and - in case someone has issues with rustup / rustc not being available, run the
curl https://sh.rustup.rs -sSf | sh
as homeassistant user, exit the shell, e.g. exit and again login, check echo $PATH and confirm that homeassistant/.cargo/bin is on it and rustc --version gives some version back

2 Likes