Search code examples
amazon-web-servicesaws-lambdaaws-lambda-layersamazon-transcribe

Unable to import module 'lambda_function': No module named '_awscrt'


I'm working with this article Asynchronous Amazon Transcribe Streaming SDK for Python.

I'm trying to create a lambda layer for the required libraries.

I used the following command:

pip3 install amazon-transcribe aiofile -t .

But I get the following error when I use the layer in my lambda function:

Unable to import module 'lambda_function': No module named '_awscrt'

The same works fine with virtual environment locally. I'm not sure what's the exact issue.

I even tried installing awscrt separately but it didn't work.

Any kind of help will be greatly appreciated. Thanks!


Solution

  • I built the layer on Amazon Linux and it worked fine!

    The troubleshooting guide in the repo helped:

    The caio linux implementation works normal for modern linux kernel versions and file systems. So you may have problems specific for your environment. It's not a bug and might be resolved some ways:

    1. Upgrade the kernel
    2. Use compatible file system
    3. Use threads based or pure python implementation.