I’m trying to import tapo library in a Python Lambda with the following code (which works locally with an equivalent main
):
import asyncio
import os
from tapo import ApiClient
def lambda_handler(event, context):
tapo_username = "username"
tapo_password = "password"
ip_address = "ip"
client = ApiClient(tapo_username, tapo_password)
I’ve zipped this and manually uploaded on the lambda code. However, when I try to test it on my Lambda console I get:
"errorMessage": "Unable to import module 'lambda_function': No module named 'tapo.tapo'",
Things I tried:
- Just to clarify, the
tapo
dependency folder (installed throughpip
in the project) is at the same level aslambda_function.py
- Using the request dependency with the same process, it works fine
- Using a virtual env as described here
- Using a lambda layer with only that tapo package
What am I doing wrong?