3

I have the following, very simple python code in a lambda function:

from sklearn.externals import joblib
import praw
import datetime
from operator import attrgetter
import sys

def handler_name(event, context):
    return "I am a cat dog and i meow."

I have also done pip installs for scikit-learn, praw, datetime, numpy and scipy from within a python 2.7 virtualenv. I then compressed my .py file along with everything in my virtualenv's /lib/python2.7/site-packages folder into a zip and uploaded it to AWS lambda. Unfortunately when I run the code I get the following error:

Unable to import module 'mainLambda': /var/task/sklearn/__check_build/_check_build.so: invalid ELF header
___________________________________________________________________________
Contents of /var/task/sklearn/__check_build:
setup.py                  _check_build.so           __init__.pyc
__init__.py               setup.pyc
___________________________________________________________________________
It seems that scikit-learn has not been built correctly.

If you have installed scikit-learn from source, please do not forget
to build the package before using it: run `python setup.py install` or
`make` in the source directory.

If you have used an installer, please check that it is suited for your
Python version, your operating system and your platform.

Obviously the issue is with sk-learn. I have no idea what though. It could be a versioning issue but I downloaded all the libraries from within a virtulenv and chose a python2.7 lambda function. Any idea? I am stumped!

gilch
  • 10,813
  • 1
  • 23
  • 28
sometimesiwritecode
  • 2,993
  • 7
  • 31
  • 69

0 Answers0