簡體   English   中英

在 Raspberry Pi 2B (armv7h Arch Linux ARM) (python 3.9.8) 上安裝加密問題

[英]Issue installing cryptography on Raspberry Pi 2B (armv7h Arch Linux ARM) (python 3.9.8)

我在我的樹莓派上安裝 python cryptography package 時遇到了一些麻煩,特別是在 python 版本 3.9.8(安裝 pyenv)上。 cryptography package 使用 pacman( python-cryptography包)安裝在我的系統上,因此使用主 python 解釋器(3.10.1)工作。 但是,我需要一些 python 3.9 版本,專門用於我在這個項目中使用的另一個 package。 每當我嘗試通過 python 3.9.8 環境安裝cryptography學時,都會收到以下錯誤:

Building wheels for collected packages: cryptography
  Building wheel for cryptography (pyproject.toml): started
  Building wheel for cryptography (pyproject.toml): finished with status 'error'
Failed to build cryptography

  ERROR: Command errored out with exit status 1:
   command: /home/kioskuser/.local/share/virtualenvs/Kivy-Raspi-Desktop-App-EzpaxvF4/bin/python /home/kioskuser/.local/share/virtualenvs/Kivy-Raspi-Desktop-App-EzpaxvF4/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmp4zxk3vu2
       cwd: /tmp/pip-install-c5oajf7r/cryptography_5c58967b948d4a78862f30763d6e3c9e
  Complete output (163 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-armv7l-3.9
  creating build/lib.linux-armv7l-3.9/cryptography
  copying src/cryptography/utils.py -> build/lib.linux-armv7l-3.9/cryptography
  copying src/cryptography/fernet.py -> build/lib.linux-armv7l-3.9/cryptography
  copying src/cryptography/exceptions.py -> build/lib.linux-armv7l-3.9/cryptography
  copying src/cryptography/__init__.py -> build/lib.linux-armv7l-3.9/cryptography
  copying src/cryptography/__about__.py -> build/lib.linux-armv7l-3.9/cryptography
  creating build/lib.linux-armv7l-3.9/cryptography/x509
  copying src/cryptography/x509/oid.py -> build/lib.linux-armv7l-3.9/cryptography/x509
  copying src/cryptography/x509/ocsp.py -> build/lib.linux-armv7l-3.9/cryptography/x509
  copying src/cryptography/x509/name.py -> build/lib.linux-armv7l-3.9/cryptography/x509
  copying src/cryptography/x509/general_name.py -> build/lib.linux-armv7l-3.9/cryptography/x509
  copying src/cryptography/x509/extensions.py -> build/lib.linux-armv7l-3.9/cryptography/x509
  copying src/cryptography/x509/certificate_transparency.py -> build/lib.linux-armv7l-3.9/cryptography/x509
  copying src/cryptography/x509/base.py -> build/lib.linux-armv7l-3.9/cryptography/x509
  copying src/cryptography/x509/__init__.py -> build/lib.linux-armv7l-3.9/cryptography/x509
  creating build/lib.linux-armv7l-3.9/cryptography/hazmat
  copying src/cryptography/hazmat/_oid.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat
  copying src/cryptography/hazmat/__init__.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat
  creating build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives
  copying src/cryptography/hazmat/primitives/poly1305.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives
  copying src/cryptography/hazmat/primitives/padding.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives
  copying src/cryptography/hazmat/primitives/keywrap.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives
  copying src/cryptography/hazmat/primitives/hmac.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives
  copying src/cryptography/hazmat/primitives/hashes.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives
  copying src/cryptography/hazmat/primitives/constant_time.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives
  copying src/cryptography/hazmat/primitives/cmac.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives
  copying src/cryptography/hazmat/primitives/_serialization.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives
  copying src/cryptography/hazmat/primitives/_cipheralgorithm.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives
  copying src/cryptography/hazmat/primitives/_asymmetric.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives
  copying src/cryptography/hazmat/primitives/__init__.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives
  creating build/lib.linux-armv7l-3.9/cryptography/hazmat/bindings
  copying src/cryptography/hazmat/bindings/__init__.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/bindings
  creating build/lib.linux-armv7l-3.9/cryptography/hazmat/backends
  copying src/cryptography/hazmat/backends/interfaces.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/backends
  copying src/cryptography/hazmat/backends/__init__.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/backends
  creating build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives/twofactor
  copying src/cryptography/hazmat/primitives/twofactor/totp.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives/twofactor
  copying src/cryptography/hazmat/primitives/twofactor/hotp.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives/twofactor
  copying src/cryptography/hazmat/primitives/twofactor/__init__.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives/twofactor
  creating build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives/serialization
  copying src/cryptography/hazmat/primitives/serialization/ssh.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives/serialization
  copying src/cryptography/hazmat/primitives/serialization/pkcs7.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives/serialization
  copying src/cryptography/hazmat/primitives/serialization/pkcs12.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives/serialization
  copying src/cryptography/hazmat/primitives/serialization/base.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives/serialization
  copying src/cryptography/hazmat/primitives/serialization/__init__.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives/serialization
  creating build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives/kdf
  copying src/cryptography/hazmat/primitives/kdf/x963kdf.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives/kdf
  copying src/cryptography/hazmat/primitives/kdf/scrypt.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives/kdf
  copying src/cryptography/hazmat/primitives/kdf/pbkdf2.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives/kdf
  copying src/cryptography/hazmat/primitives/kdf/kbkdf.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives/kdf
  copying src/cryptography/hazmat/primitives/kdf/hkdf.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives/kdf
  copying src/cryptography/hazmat/primitives/kdf/concatkdf.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives/kdf
  copying src/cryptography/hazmat/primitives/kdf/__init__.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives/kdf
  creating build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives/ciphers
  copying src/cryptography/hazmat/primitives/ciphers/modes.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives/ciphers
  copying src/cryptography/hazmat/primitives/ciphers/base.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives/ciphers
  copying src/cryptography/hazmat/primitives/ciphers/algorithms.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives/ciphers
  copying src/cryptography/hazmat/primitives/ciphers/aead.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives/ciphers
  copying src/cryptography/hazmat/primitives/ciphers/__init__.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives/ciphers
  creating build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives/asymmetric
  copying src/cryptography/hazmat/primitives/asymmetric/x448.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives/asymmetric
  copying src/cryptography/hazmat/primitives/asymmetric/x25519.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives/asymmetric
  copying src/cryptography/hazmat/primitives/asymmetric/utils.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives/asymmetric
  copying src/cryptography/hazmat/primitives/asymmetric/types.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives/asymmetric
  copying src/cryptography/hazmat/primitives/asymmetric/rsa.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives/asymmetric
  copying src/cryptography/hazmat/primitives/asymmetric/padding.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives/asymmetric
  copying src/cryptography/hazmat/primitives/asymmetric/ed448.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives/asymmetric
  copying src/cryptography/hazmat/primitives/asymmetric/ed25519.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives/asymmetric
  copying src/cryptography/hazmat/primitives/asymmetric/ec.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives/asymmetric
  copying src/cryptography/hazmat/primitives/asymmetric/dsa.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives/asymmetric
  copying src/cryptography/hazmat/primitives/asymmetric/dh.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives/asymmetric
  copying src/cryptography/hazmat/primitives/asymmetric/__init__.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/primitives/asymmetric
  creating build/lib.linux-armv7l-3.9/cryptography/hazmat/bindings/openssl
  copying src/cryptography/hazmat/bindings/openssl/binding.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/bindings/openssl
  copying src/cryptography/hazmat/bindings/openssl/_conditional.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/bindings/openssl
  copying src/cryptography/hazmat/bindings/openssl/__init__.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/bindings/openssl
  creating build/lib.linux-armv7l-3.9/cryptography/hazmat/backends/openssl
  copying src/cryptography/hazmat/backends/openssl/x509.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/backends/openssl
  copying src/cryptography/hazmat/backends/openssl/x448.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/backends/openssl
  copying src/cryptography/hazmat/backends/openssl/x25519.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/backends/openssl
  copying src/cryptography/hazmat/backends/openssl/utils.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/backends/openssl
  copying src/cryptography/hazmat/backends/openssl/rsa.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/backends/openssl
  copying src/cryptography/hazmat/backends/openssl/poly1305.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/backends/openssl
  copying src/cryptography/hazmat/backends/openssl/hmac.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/backends/openssl
  copying src/cryptography/hazmat/backends/openssl/hashes.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/backends/openssl
  copying src/cryptography/hazmat/backends/openssl/encode_asn1.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/backends/openssl
  copying src/cryptography/hazmat/backends/openssl/ed448.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/backends/openssl
  copying src/cryptography/hazmat/backends/openssl/ed25519.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/backends/openssl
  copying src/cryptography/hazmat/backends/openssl/ec.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/backends/openssl
  copying src/cryptography/hazmat/backends/openssl/dsa.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/backends/openssl
  copying src/cryptography/hazmat/backends/openssl/dh.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/backends/openssl
  copying src/cryptography/hazmat/backends/openssl/decode_asn1.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/backends/openssl
  copying src/cryptography/hazmat/backends/openssl/cmac.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/backends/openssl
  copying src/cryptography/hazmat/backends/openssl/ciphers.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/backends/openssl
  copying src/cryptography/hazmat/backends/openssl/backend.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/backends/openssl
  copying src/cryptography/hazmat/backends/openssl/aead.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/backends/openssl
  copying src/cryptography/hazmat/backends/openssl/__init__.py -> build/lib.linux-armv7l-3.9/cryptography/hazmat/backends/openssl
  running egg_info
  no previously-included directories found matching 'docs/_build'
  warning: no previously-included files found matching 'vectors'
  warning: no previously-included files matching '*' found under directory 'vectors'
  warning: no previously-included files matching '*' found under directory '.github'
  warning: no previously-included files found matching 'release.py'
  warning: no previously-included files found matching '.coveragerc'
  warning: no previously-included files found matching 'codecov.yml'
  warning: no previously-included files found matching '.readthedocs.yml'
  warning: no previously-included files found matching 'dev-requirements.txt'
  warning: no previously-included files found matching 'tox.ini'
  warning: no previously-included files found matching 'mypy.ini'
  warning: no previously-included files matching '*' found under directory '.zuul.d'
  warning: no previously-included files matching '*' found under directory '.zuul.playbooks'
  writing manifest file 'src/cryptography.egg-info/SOURCES.txt'
  copying src/cryptography/py.typed -> build/lib.linux-armv7l-3.9/cryptography
  creating build/lib.linux-armv7l-3.9/cryptography/hazmat/bindings/_rust
  copying src/cryptography/hazmat/bindings/_rust/__init__.pyi -> build/lib.linux-armv7l-3.9/cryptography/hazmat/bindings/_rust
  copying src/cryptography/hazmat/bindings/_rust/asn1.pyi -> build/lib.linux-armv7l-3.9/cryptography/hazmat/bindings/_rust
  copying src/cryptography/hazmat/bindings/_rust/ocsp.pyi -> build/lib.linux-armv7l-3.9/cryptography/hazmat/bindings/_rust
  copying src/cryptography/hazmat/bindings/_rust/x509.pyi -> build/lib.linux-armv7l-3.9/cryptography/hazmat/bindings/_rust
  warning: build_py: byte-compiling is disabled, skipping.
  
  running build_ext
  cargo rustc --lib --manifest-path src/rust/Cargo.toml --release -v --features pyo3/abi3-py36 pyo3/extension-module -- --crate-type cdylib
     Compiling proc-macro2 v1.0.32
     Compiling unicode-xid v0.2.2
     Compiling syn v1.0.81
     Compiling autocfg v1.0.1
       Running `rustc --crate-name build_script_build --edition=2018 /home/kioskuser/.cargo/registry/src/github.com-1285ae84e5963aae/proc-macro2-1.0.32/build.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debug-assertions=off -C overflow-checks=on --cfg 'feature="default"' --cfg 'feature="proc-macro"' -C metadata=7a95d32b66ae1a1f -C extra-filename=-7a95d32b66ae1a1f --out-dir /tmp/pip-install-c5oajf7r/cryptography_5c58967b948d4a78862f30763d6e3c9e/src/rust/target/release/build/proc-macro2-7a95d32b66ae1a1f -L dependency=/tmp/pip-install-c5oajf7r/cryptography_5c58967b948d4a78862f30763d6e3c9e/src/rust/target/release/deps --cap-lints allow`
       Running `rustc --crate-name unicode_xid /home/kioskuser/.cargo/registry/src/github.com-1285ae84e5963aae/unicode-xid-0.2.2/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debug-assertions=off -C overflow-checks=on --cfg 'feature="default"' -C metadata=2b7724452eebc032 -C extra-filename=-2b7724452eebc032 --out-dir /tmp/pip-install-c5oajf7r/cryptography_5c58967b948d4a78862f30763d6e3c9e/src/rust/target/release/deps -L dependency=/tmp/pip-install-c5oajf7r/cryptography_5c58967b948d4a78862f30763d6e3c9e/src/rust/target/release/deps --cap-lints allow`
       Running `rustc --crate-name build_script_build --edition=2018 /home/kioskuser/.cargo/registry/src/github.com-1285ae84e5963aae/syn-1.0.81/build.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debug-assertions=off -C overflow-checks=on --cfg 'feature="clone-impls"' --cfg 'feature="default"' --cfg 'feature="derive"' --cfg 'feature="extra-traits"' --cfg 'feature="full"' --cfg 'feature="parsing"' --cfg 'feature="printing"' --cfg 'feature="proc-macro"' --cfg 'feature="quote"' -C metadata=6954389b44e215f9 -C extra-filename=-6954389b44e215f9 --out-dir /tmp/pip-install-c5oajf7r/cryptography_5c58967b948d4a78862f30763d6e3c9e/src/rust/target/release/build/syn-6954389b44e215f9 -L dependency=/tmp/pip-install-c5oajf7r/cryptography_5c58967b948d4a78862f30763d6e3c9e/src/rust/target/release/deps --cap-lints allow`
       Running `rustc --crate-name autocfg /home/kioskuser/.cargo/registry/src/github.com-1285ae84e5963aae/autocfg-1.0.1/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debug-assertions=off -C overflow-checks=on -C metadata=062cd71dd028816e -C extra-filename=-062cd71dd028816e --out-dir /tmp/pip-install-c5oajf7r/cryptography_5c58967b948d4a78862f30763d6e3c9e/src/rust/target/release/deps -L dependency=/tmp/pip-install-c5oajf7r/cryptography_5c58967b948d4a78862f30763d6e3c9e/src/rust/target/release/deps --cap-lints allow`
  error: could not compile `unicode-xid`
  
  Caused by:
    process didn't exit successfully: `rustc --crate-name unicode_xid /home/kioskuser/.cargo/registry/src/github.com-1285ae84e5963aae/unicode-xid-0.2.2/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debug-assertions=off -C overflow-checks=on --cfg 'feature="default"' -C metadata=2b7724452eebc032 -C extra-filename=-2b7724452eebc032 --out-dir /tmp/pip-install-c5oajf7r/cryptography_5c58967b948d4a78862f30763d6e3c9e/src/rust/target/release/deps -L dependency=/tmp/pip-install-c5oajf7r/cryptography_5c58967b948d4a78862f30763d6e3c9e/src/rust/target/release/deps --cap-lints allow` (signal: 4, SIGILL: illegal instruction)
  warning: build failed, waiting for other jobs to finish...
  error: build failed
  
      =============================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.8
      platform: Linux-5.10.90-1-rpi-ARCH-armv7l-with-glibc2.32
      pip: n/a
      setuptools: 60.5.0
      setuptools_rust: 1.1.2
      =============================DEBUG ASSISTANCE=============================
  
  error: cargo failed with code: 101
  
  ----------------------------------------
  ERROR: Failed building wheel for cryptography
ERROR: Could not build wheels for cryptography, which is required to install pyproject.toml-based projects

✘ Installation Failed

到目前為止,我已經嘗試過:

  1. 升級 pip(現在版本 21.3.1)
  2. 確保安裝了 rust 編譯器(rustc 版本 1.57.0)
  3. 確保已安裝libffi (版本 3.4.2)
  4. 確保安裝了OpenSSL (版本 1.1.1)
  5. 作為一個 Arch Linux 系統,我當然為gcc編譯器(版本 10.2.0)安裝了 gcc
  6. 將問題隔離到這個 package (我最初試圖安裝cryptography作為msal的依賴項)
  7. 嘗試使用 pipenv 以及直接導航到~/.pyenv/versions/3.9.8目錄中的 python 可執行文件
  8. ~/.pyenv/versions/3.9.8目錄中,嘗試使用 pip 可執行文件以及./python -m pip進行安裝,兩次都得到相同的結果。
  9. 上述步驟還包括檢查錯誤消息中建議的所有 4 個調試步驟。

還需要注意的是,所有這些都可以在我的主系統上的虛擬環境中完美運行(也是 Arch Linux,但 x86_64 而不是 ARM)。

我還能嘗試什么來安裝cryptography package?

或者,看起來相同版本的庫通過pacman安裝在主站點包中,但虛擬環境或 python 的單獨版本當然無法識別。 有什么方法可以強制 python 3.9.8 使用 package 代替嗎?

@jakub 的解決方案最終為我解決了問題。 我卸載了通過pacman安裝的 rust 版本。 為了替換它,我安裝了rustup ,然后使用rustup ,安裝了最新的夜間版本 rust (1.60)。 一旦我這樣做了,安裝cryptography package 就可以了。

如果您使用的是rustup ,請確保在安裝~/.cargo/bin添加到PATH中。 另外,我用來通過 rustup 安裝 rust 的命令是rustup toolchain install nightly

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM