ERROR: Failed building wheel for cryptography

The export trick doesn’t work anymore in 2021.12, due to “cryptography” being bumped to 3.5.
That did the trick for me, i.e. installing a newer rust/cargo from origin.

1 Like

Excellent, that worked. To clarify, these are the commands I ran:
sudo apt remove rustc
sudo curl https://sh.rustup.rs -sSf | sh

Thanks so much!

1 Like

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