No module named '_cffi_backend'
Hello,
I have issues when I try to use any Python version above 3.7 with cffi. I am using snowflake-connector-python in my Lambda function which includes Cryptography. This is where cffi is dependent, I believe. I am building my package in Amazon Linux 2 environment in Gitlab with Docker using x86_64.
When I use this package, I don't get the error:
cffi-1.15.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
But when I upgrade my Python to v3.10, for example, I get this wheel that throws this error:
cffi-1.15.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
The error logs exactly:
[ERROR] Runtime.ImportModuleError: Unable to import module 'main': No module named '_cffi_backend'
The only solutions I found are packaging my own wheels and uploading to Lambda as a layer or downgrading to Python 3.7. To my work constraints, I can't package my own wheels, and I need to upgrade my function to Python 3.10.
I have tried: -change the cffi version -change cryptography version -import cffi in my code -tried python v3.8, v3.9, v3.10 -remove the constraints for cryptography to latest version, i got the same error
requirements.txt
snowflake-connector-python
requests
cryptography==3.4.8
You can also see this user having the same issue, I tried what he tried as well:
https://stackoverflow.com/questions/76443834/aws-lambda-python-3-10-no-module-named-cffi-backend