Could not build wheels for cryptography error - raspberry pi, docker-compose

I’m trying to install docker-compose on my Raspberry pi Lite OS but am getting this ERROR: Could not build wheels for cryptography, which is required to install pyproject.toml-based projects error.

I’ve tried installing and re-installing rust to no avail. The command I used to get this error was sudo pip3 install docker-compose. I’ve also tried installing rustc after receiving this error to no avail.

      copying src/cryptography/hazmat/bindings/_rust/openssl/x448.pyi -> build/lib.linux-armv7l-cpython-39/cryptography/hazmat/bindings/_rust/openssl
      running build_ext
      running build_rust

          =============================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.9.2
          platform: Linux-6.1.21-v7+-armv7l-with-glibc2.31
          pip: n/a
          setuptools: 68.2.2
          setuptools_rust: 1.7.0
          rustc: n/a
          =============================DEBUG ASSISTANCE=============================

      error: can't find Rust compiler

      If you are using an outdated pip version, it is possible a prebuilt wheel is available for this package but pip is not able to install from it. Installing from the wheel would avoid the need for a Rust compiler.

      To update pip, run:

          pip install --upgrade pip

      and then retry package installation.

      If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.

      This package requires Rust >=1.56.0.
      [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, I’ve got exactly the same problem. On my rapsberry pi4.

Did you try to solve this?

So I did ‘solve’ it in my case. I tried everything with rust installs, but I ended up re-flashing the Pi OS Lite again, but the 64-bit version. That worked just fine. I imagine something with the 32-bit version of the Lite OS doesn’t support this installation.