AWS Lambda Python Puzzle

I have an AWS Lambda function that is written in Python 3.8 and imports the following modules:

import ask_sdk_core.utils as ask_utils
import regex as re

I decided to include the package files for these modules in a Layer so that I could separate “their code” from “my code.” I ran the following at the command line:

md package\python\lib\python3.8\site-packages
cd package\python\lib\python3.8\site-packages
pip install -–target . ask_sdk_core 
pip install --target . regex

I zipped it all up into and uploaded it to the Layer, per these instructions: When I ran my test code it complained:

  "errorMessage": "Unable to import module 'lambda_function': No module named 'regex._regex'",
  "errorType": "Runtime.ImportModuleError"

I knew my Layer was configured properly because the ask_sdk_core module was found before the regex wasn’t. Somehow, I stumbled across this article: This was the solution.

So I navigated to and searched for regex. Then clicked downloads. Then found the Python 3.8 version of the manylinux1_x86_64.whl file, which was called:


I unzipped this file to my package\python\lib\python3.8\site-packages folder. Zipped it all up, uploaded to a new version of my Layer, removed the old Layer from the Lambda function and added the new one.

This time my test code worked like a charm.

Thank you to the Alexa Community ( for your unwavering support during this ordeal.

2 thoughts on “AWS Lambda Python Puzzle

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.