Import-Fehler aus cyptography.hazmat.Bindungen._constant_time import-lib

So, ich versuche zum erstellen einer aws lambda-Funktion zur Anmeldung an einer Instanz, und führen Sie einige Sachen. Und das Skript funktioniert außerhalb von lambda, aber wenn ich das Paket mit den gleichen Anweisungen wie diese https://aws.amazon.com/blogs/compute/scheduling-ssh-jobs-using-aws-lambda/ es funktioniert nicht. Es wirft diese Fehlermeldung.

libffi-72499c49.so.6.0.4: cannot open shared object file: No such file or directory: ImportError
Traceback (most recent call last):
  File "/var/task/lambda_function.py", line 12, in lambda_handler
    key = paramiko.RSAKey.from_private_key(key)
  File "/var/task/paramiko/pkey.py", line 217, in from_private_key
    key = cls(file_obj=file_obj, password=password)
  File "/var/task/paramiko/rsakey.py", line 42, in __init__
    self._from_private_key(file_obj, password)
  File "/var/task/paramiko/rsakey.py", line 168, in _from_private_key
    self._decode_key(data)
  File "/var/task/paramiko/rsakey.py", line 173, in _decode_key
    data, password=None, backend=default_backend()
  File "/var/task/cryptography/hazmat/backends/__init__.py", line 35, in default_backend
    _default_backend = MultiBackend(_available_backends())
  File "/var/task/cryptography/hazmat/backends/__init__.py", line 22, in _available_backends
    "cryptography.backends"
  File "/var/task/pkg_resources/__init__.py", line 2236, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/var/task/cryptography/hazmat/backends/openssl/__init__.py", line 7, in <module>
    from cryptography.hazmat.backends.openssl.backend import backend
  File "/var/task/cryptography/hazmat/backends/openssl/backend.py", line 15, in <module>
    from cryptography import utils, x509
  File "/var/task/cryptography/x509/__init__.py", line 7, in <module>
    from cryptography.x509.base import (
  File "/var/task/cryptography/x509/base.py", line 15, in <module>
    from cryptography.x509.extensions import Extension, ExtensionType
  File "/var/task/cryptography/x509/extensions.py", line 19, in <module>
    from cryptography.hazmat.primitives import constant_time, serialization
  File "/var/task/cryptography/hazmat/primitives/constant_time.py", line 9, in <module>
    from cryptography.hazmat.bindings._constant_time import lib
ImportError: libffi-72499c49.so.6.0.4: cannot open shared object file: No such file or directory
  • überprüfen Sie Ihre Bibliothek Versionen - besonders openssl
  • wie soll ich das tun? Wenn ich es installieren, ich installiere es von pip. Die nur zwei Befehle, die ich mache, sind pip install pycrypto und pip install paramiko und es funktioniert wenn ich es auf meinem eigenen server. Das problem tritt nur auf, wenn ich werfen Sie auf aws lambda
  • pip freeze listet alle Bibliotheken auf Ihrem server-Umgebung. Ich weiß nicht, wie zu überprüfen, auf AWS. Sie könnten Fragen auf dem blog, wo solche Anweisungen gegeben wurden.
Schreibe einen Kommentar