question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to import module '[module_name]': /var/task/Crypto/Cipher/_AES.so: invalid ELF header

See original GitHub issue

I’m trying to use credstash to retrieve credentials in an aws lambda function e.g.

from credstash import getSecret
password = getSecret(USERNAME)

But I’m getting the following error when the function runs:

Unable to import module '[module_name]': /var/task/Crypto/Cipher/_AES.so: invalid ELF header

I’m not sure what the cause is. My lambda function lives in a virtualenv, and when I deploy I copy the contents of lib/python2.7/site-packages/ into the zip. Do you have any ideas?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
alex-luminalcommented, Jun 7, 2016

The python openssl library brings a shared library along with it. You want to make sure you build your virtualenv on a linux box. If you build it on OSX, the shared library will be build for OSX, not for linux.

0reactions
iamazizcommented, Dec 20, 2017

Thanks a million @alex-luminal saved my day!

Read more comments on GitHub >

github_iconTop Results From Across the Web

aws - "Unable to import module 'process': /var/task/numpy/core ...
The problem has to do with the multiarray.so file which was complied on my local computer's architecture. Spin up an ec2 instance and...
Read more >
How to resolve an invalid ELF header error quickly
Are you experiencing an “Invalid ELF header” error when executing your AWS Lambda? If so, you have came to the right place for...
Read more >
Faild to launch flatpak "Bottles". Getting libgtk-4.so.1 invalid ...
Getting libgtk-4.so.1 invalid ELF header issue ... File "/app/bin/bottles", line 43, in <module> from bottles.frontend import main File ...
Read more >
AWS lambda layers / package import issues - Reddit
"errorMessage": "Unable to import module 'lambda_function': /var/task/nacl/_sodium.abi3.so: invalid ELF header","errorType": "Runtime.
Read more >
apache2 invalid elf header - Google Groups
New install of SO as a server. ... into server: /usr/lib/apache2/modules/mod_alias.so: invalid ELF header. Action 'restart' failed.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found