Python-binance in AWS Lambda issue: Unable to import module ... No module named 'regex._regex'

Viewed 915

I'm trying to run an AWS lambda function to retrieve latest crypto prices using python-binance. Everything works fine when using VS Code locally, but when I deploy it (with serverless or zip), I get this error:

{
  "errorMessage": "Unable to import module 'handlers/action': No module named 'regex._regex'",
  "errorType": "Runtime.ImportModuleError"
}

For optimization purposes, I attach a layer to the lambda function in order to use Pandas.

Tests:

  • Deployed lambda function with both python-binance and pandas whilst specifying versions.
  • Tried python-binance --no-binary :all: but got a complain from servleress

I don't understand why that would work locally, but not on AWS. Checking online, no one has addressed this issue directly, but there are discussions around Windows vs Linux (I'm using Windows)

requirements.txt

python-binance

imports

# IMPORTS
import pandas as pd
import math
from binance.client import Client
from dateutil import parser
import datetime

Environment Information

  Your Environment Information ---------------------------
     Operating System:          win32
     Node Version:              12.18.3
     Framework Version:         1.79.0
     Plugin Version:            3.7.1
     SDK Version:               2.3.1
     Components Version:        2.34.7
0 Answers
Related