-
Notifications
You must be signed in to change notification settings - Fork 524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OSError: Cannot load native module 'Crypto.Hash._SHA256' #157
Comments
Hi @mcopley08 I'm getting this same error, how did you solve it? |
I also have this error. I am trying to import pyrebase using AWS lambda handler function. |
I'm facing this issue as well when importing pyrebase on AWS Lambda, please advise |
This is how I solved it. I went into |
Could someone please explain how to fix this package so it works on AWS Lambda? What needs to be installed or configured? Could we re-open this ticket please? |
Same issue (running on AWS lambda). Any ideas? |
Same issue also. I believe it's because Crypto doesn't support Python 3.6 |
I also see this issue when packaging with pyinstaller. |
I ran into this issue a yesterday with Crypto on lambda (via zappa), and I didn't see anyone post a fix, but here's what I did -> The problem manifests itself in zappa because the native library is compiled on the client arch and uploaded - instead of on the lambda arch. As a quick solve, I downloaded an Amazon Linux vagrant box, shared the path on my machine to the box via config.vm.synced_folder, and then deployed to lambda through the vagrant box. |
My comment above provides a way to make it work. I have successfully used pyrebase with AWS Lambda at this point. |
It is possible that having Good chance the |
@wtesler Hi Will, following your advice, here's what I did:
But issue remains, is there anything that I missed? Thank you. |
I know I'm really late to all of this - but I restarted my computer as a last resort and it started working on my local machine. |
i commented |
Has this been patched/an actual fix been found? |
In my case, I remove the folder Crypto And it works on Lambda |
Did anyone fix this? |
I had the same problem with serverless framework and lambda, and solved it building my serverless app in a linux environment. (i was using OSX before) |
had the same issue with the Crypto.Hash._SHA256 module in the lambda function, using Python 3.7. fixed that adding the library pycrypto, https://pypi.org/project/pycrypto/ |
For those of you having problems with the implementation on AWS Lambda: The problem is most likely the difference between the runtime you are using to build your deployment package and the runtime used by your Lambda. In my case I was using python3.6 in my machine while having the python3.7 runtime in AWS. To solve this without messing with your local version of Python, you can:
|
works thanks |
I received the same error. I figured the root cause. Putting it here hoping it would help somebody. In my case, I had originally created the python package for AWS lambda in ubuntu. The pycryptodome package installed the static for that required by the linux system (_SHA256.cpython-36m-x86_64-linux-gnu.so). These libraries has extension '.so'. Now, when I tried running the package on my windows machine it threw error since on windows it was looking for library compatible on windows system (_SHA256.cp36-win_amd64.pyd) and my package had the library for linux systems (_SHA256.cpython-36m-x86_64-linux-gnu.so). Fixes: For windows (to run locally):
For running code on AWS lambda: Simple solution, switch to a linux machine. Create a virtual environment and install all the required files using pip install. Then use this to deploy on lambda. If you don't have access to a linux system. Just pick the file from here (get "_SHA256.cpython-36m-x86_64-linux-gnu.so") and put in the folder Crypto/Hash/ folder. |
If you arrive here because of AWS lambda runtime issue I would recommend doing the following:
|
When I try to run a python file that only has the line:
import pyrebase
I get the following issue:
I've researched this issue elsewhere, and I've tried switching my 64-bit python3 executable to a 32-bit, reinstalling dependencies, and nothing has resolved this issue yet.
Here is my setup information:
Any help on what can resolve this issue will be greatly appreciated!
The text was updated successfully, but these errors were encountered: