pyca / cryptography

cryptography is a package designed to expose cryptographic primitives and recipes to Python developers.
https://cryptography.io
Other
6.4k stars 1.47k forks source link

cryptography Importerror dlopen failed #11083

Open ianovert opened 3 weeks ago

ianovert commented 3 weeks ago

Hi i was compiling my apk on google colab when I experienced the error below which version of cryptography will fix the issue?

Versions

Python 3.11 Cffi 1.15.1 Setuptools 69.2.0 cryptography 42.0.8

File "/usr/local/lib/python3.11/site-packages/cryptography/exceptions.py", line 9, in from cryptography.hazmat.bindings._rust import exceptions as rust_exceptions ImportError: /usr/local/lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust.abi3.so

alex commented 3 weeks ago

This does not provide us any meaningful information. Please provide complete instructions on how you installed cryptography so that we can reproduce.

ianovert commented 3 weeks ago

Hi I’m using pyrebase4 so i have to add cryptography to my buildozer.spec file. And it’s being installed though pip install cryptography on windows google colab while compiling the apk.

alex commented 3 weeks ago

Sorry, I'm very confused: are you trying to build for an android device, or run this in a colab notebook?

omar1developer commented 2 weeks ago

Cryptography issues after upgrading to Python 3.12

github-actions[bot] commented 2 weeks ago

This issue has been waiting for a reporter response for 3 days. It will be auto-closed if no activity occurs in the next 5 days.

jetrudel commented 1 week ago

I have the same issue. It happens on Mac (14.5) in my case. A fresh install of cryptography package with pip on python 3.9 or python 3.11 (inside a venv), with any version ranging from 41.0.5 to 42.0.8 (can't go lower because of project dependency) is enough to cause the issue. cffi==1.16.0 in all versions I've tried. I tried recreating the virtual environment from scratch and same error.

If I run the following statement I get the error:

from cryptography.hazmat.bindings._rust import exceptions

Full error in my case:

ImportError: dlopen(/Users/{name}/venv/py3_11/lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust.abi3.so, 0x0002): tried: '/Users/{name}/venv/py3_11/lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust.abi3.so' (mmap(size=0xF230FA) failed with errno=1), '/System/Volumes/Preboot/Cryptexes/OS/Users/{name}/venv/py3_11/lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust.abi3.so' (no such file), '/Users/{name}/venv/py3_11/lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust.abi3.so' (mmap(size=0xF230FA) failed with errno=1)

github-actions[bot] commented 1 week ago

This issue has been waiting for a reporter response for 3 days. It will be auto-closed if no activity occurs in the next 5 days.

Clokkehl commented 6 days ago

I have the exact same error. Python 3.11, Cryptography v 42.0.8. Running on an AWS Lambda environment building with Serverless v3.39, using the serverless-python-requirements plugin to make a zip version of the requirements. It's using a datadog_lambda_handler for reporting, but if I remove it just picks a different package to replace instead. Error Log: Runtime.ImportModuleError: Unable to import module 'datadog_lambda.handler': /lib64/libc.so.6: versionGLIBC_2.28' not found (required by /tmp/sls-py-req/cryptography/hazmat/bindings/_rust.abi3.so)`

alex commented 6 days ago

This means you used a manylinux wheel for a too-recent platform for lambda. Please see the lambda docs on native modules

On Mon, Jun 24, 2024, 1:40 PM James Lake @.***> wrote:

I have the exact same error. Python 3.11, Cryptography v 42.0.8. Running on an AWS Lambda environment building with Serverless v3.39, using the serverless-python-requirements plugin to make a zip version of the requirements. It's using a datadog_lambda_handler for reporting, but if I remove it just picks a different package to replace instead. Error Log: Runtime.ImportModuleError: Unable to import module 'datadog_lambda.handler': /lib64/libc.so.6: version GLIBC_2.28' not found (required by /tmp/sls-py-req/cryptography/hazmat/bindings/_rust.abi3.so)`

— Reply to this email directly, view it on GitHub https://github.com/pyca/cryptography/issues/11083#issuecomment-2187085687, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAAGBEU5VYQGRWTOVV6GITZJBKX3AVCNFSM6AAAAABI6BK2KCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBXGA4DKNRYG4 . You are receiving this because you commented.Message ID: @.***>

github-actions[bot] commented 2 days ago

This issue has been waiting for a reporter response for 3 days. It will be auto-closed if no activity occurs in the next 5 days.