Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
524 views
in Technique[技术] by (71.8m points)

python - aws - "Unable to import module 'process': /var/task/numpy/core/multiarray.so: invalid ELF header"

Using aws lambda I am receiving the following error when the script is run with the numpy module:

Unable to import module 'process': /var/task/numpy/core/multiarray.so: invalid ELF header

Is this problem related to numpy itself or numpy specifically on aws lambda. What is an invalid ELF header?

Edit:

I believe this is related to native code execution, as stated in this answer "invalid ELF header" when using the nodejs "ref" module on AWS Lambda

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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 create your virtualenv with the necessary dependencies. This will cause it to compile with the correct architecture as used by Aws lambda. Then download your virtualenv from the ec2 instance and use that for lambda.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...