0

I am working on aws lambda function, i install the package but i got error

Unable to import module 'lambda_function': cannot import name 'cygrpc' from 'grpc._cython' (/var/task/grpc/_cython/init.py)

How to solve this type of error?

1

2 Answers 2

1

In addition to an answer marked correct I wanted to mention that for libraries using C-extensions is important that the layer was built on the same type of system as it runs in lambda. For example, if you're trying to build the layer including grpc on MacOS most likely it won't work since lambda is running on Linux. To make the layer working you have to build it in a Linux system (for example, on the virtual machine or in Docker)

0

Are you trying to import it in code without haveing it installed on the lambda container? If you gonna use none std libs you should have you function and its libs installed locally and when zip it and upload it to Lambda.

Docs: https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-package.html

4
  • Thanks for your suggest sir, But I am already Upload the zip format attached to packages but i got same issue
    – Natarajan
    Sep 28, 2021 at 7:09
  • Does the import works when you try the lib locally? Sep 28, 2021 at 7:13
  • yes sir i am first create one environment locally and then need packages install it then convert to zip format and upload it
    – Natarajan
    Sep 28, 2021 at 7:19
  • did you managed to solve it? Aug 18 at 20:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.