Importing pandas throws numpy error (Amplify)

0

Importing pandas throws numpy error (Amplify) after Amplify push, the lambda is created but running a test fails with the below error:

[ERROR] Runtime.ImportModuleError: Unable to import module 'index': Unable to import required dependencies: numpy: Error importing numpy: you should not try to import numpy from its source directory; please exit the numpy source tree, and relaunch your python interpreter from there. Traceback (most recent call last):

this is how I'm importing pandas in my lambda:

import pandas as pd

relevant solutions:

  1. use aws pandas layers lambda --> I cant use this
  2. download architecture specific binaries --> when I use this command: pipenv install --platform==manylinux1_x86_64 pandas, it throws error saying: pipenv.patched.pip._internal.exceptions.InstallationError: Invalid requirement: '--platform==manylinux1_x86_64'

how else can i solve this error in my amplify lambda ?

已提問 5 個月前檢視次數 420 次
1 個回答
0
已接受的答案

the only way I found working is to use the AWS-provided Pandas lambda layer

已回答 5 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南