0

Its been 4 days I am trying to solve this problem. I have created my code on local machine. Lambda function created on local machine is working perfectly fine. when I zip it with liberaries as mentioned in aws creating liberaries wit aws. and upload the zip folder to S3 bucket. Till here everything works fine. problem appears when I use this link in lambda function. lambda function does not find the sklearn liberary and return error

START RequestId: bf7b2618-34c5-11e7-a8eb-43a949065813 Version: $LATEST Unable to import module 'main': dynamic module does not define module export function (PyInit__check_build)


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.

I have tried all possible ways so far I found. when i run this command to build this package

python setup.py install or build

error appears Cpython __check_buid missing. Its been 4 days I tried everything. If anyone knows. Please help me out here.Thank you in advance.

Ch HaXam
  • 499
  • 3
  • 16

1 Answers1

0

These are probably the same issues as with psycopg2, pandas, numpy and other libraries with complex dependencies - you'll have to build them from source, and not locally, but either using Amazon Linux instance, or Amazon Linux docker image. The steps in AWS docs mention it even, look at point 4 in the docs:

  1. Connect to a 64-bit Amazon Linux instance via SSH.

You can omit this step and do it locally with some libraries, like requests or pytz, but more complex ones require Amazon Linux.

For your particular problem, step by step solution is described here

Adam Owczarczyk
  • 2,802
  • 1
  • 16
  • 21
  • Thanks Adam, I tried one you mentioned in step by step solution. but could not go ahead after docker run image. image unable to find build.sh file. I somehow mange to manually generate it. but still not working. Can you little bit explain about locally creation of this library with requests thanks – Ch HaXam May 11 '17 at 07:19
  • With libraries like `requests` you can just `pip install -t /yourlambdadirectory/ requests` and then zip them, upload them and this will work fine. For libraries like pandas you have to either find someone who precompiled them for you on Amazon Linux, or do it yourself. I never did that myself, always used already precompiled. In [this link] (https://github.com/moesy/lambda.service.skeleton) you have fairly recent pandas you can try. It is based on [this answer] (http://stackoverflow.com/questions/36054976/pandas-aws-lambda). I haven't found precompiled sklearn tho, sorry. – Adam Owczarczyk May 11 '17 at 11:36