skip to Main Content

I was installing firebase-admin using pip on my raspberry pi 3b+ using the following command:

pip3 install firebase-admin

However it always ends with an error saying "Error building wheel for cryptography"

Here is the full error message:

/tmp/pip-build-env-k7qo7p54/overlay/lib/python3.7/site-packages/setuptools/command/build_py.py:202: SetuptoolsDeprecationWarning: Installing ‘cryptography.hazmat.bindings._rust’ as data is deprecated, please list it in packages.
!!

      ############################
      # Package would be ignored #
      ############################
      Python recognizes 'cryptography.hazmat.bindings._rust' as an importable package,
      but it is not listed in the `packages` configuration of setuptools.
  
      'cryptography.hazmat.bindings._rust' has been automatically added to the distribution only
      because it may contain data files, but this behavior is likely to change
      in future versions of setuptools (and therefore is considered deprecated).
  
      Please make sure that 'cryptography.hazmat.bindings._rust' is included as a package by using
      the `packages` configuration field or the proper discovery methods
      (for example by using `find_namespace_packages(...)`/`find_namespace:`
      instead of `find_packages(...)`/`find:`).
  
      You can read more about "package discovery" and "data files" on setuptools
      documentation page.
  
  
  !!
  
    check.warn(importable)
  
      =============================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.7.3
      platform: Linux-5.10.103-v7+-armv7l-with-debian-10.13
      pip: n/a
      setuptools: 67.0.0
      setuptools_rust: 1.5.2
      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.48.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

I have tried different commands like:

pip3 install firebase-admin

or

python -m pip install firebase-admin

I have upgraded pip and tried again, but still it didn’t work

I faced a similar problem long time ago and solved by installing openssl. Tried it this time, it didn’t work
Also tried installing rust compiler and using it but it didn’t work

I am using Raspbian OS Buster on my Raspberry Pi 3

I have tried fresh installs of the OS
Still the same problem occurs

2

Answers


  1. This error message means that the Rust compiler (rustc) isn’t installed on your system or isn’t accessible via your system’s PATH.

    The Rust programming language is required to build certain Python packages, such as packages that use the PyO3 or rust-cpython extensions to interface with Rust.

    To solve this issue, you’ll need to install Rust. You can do this using the Rust version manager, rustup. Here’s how to install it:

    Open a terminal.
    Download and install rustup by running the following command:

    1. Open a terminal.
    2. Download and install rustup by running the following command:
    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    

    If everything went well, this should display the version of rustc that was installed. You should now be able to build packages that depend on Rust.

    If you’re still having issues after installing Rust, make sure the Rust path is correctly set in your PATH environment variable. You can add Rust to your PATH by adding the following line to your ~/.bashrc or ~/.bash_profile file (or the equivalent for your shell):

    source $HOME/.cargo/env
    
    Login or Signup to reply.
  2. I was also facing the same issue.

    Installing firebase_admin (pip install_firebase_admin) would fail, as well as upgrading the existing version of cryptography pip install cryptography --upgrade

    I finally solved it using the Debian / Ubuntu chapter of cryptography installation doc, and running the following command :

    sudo apt-get install build-essential libssl-dev libffi-dev python3-dev cargo pkg-config
    

    Firebase admin installation was finally successful afterwards !

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search