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 ?

demandé il y a 5 mois411 vues
1 réponse
0
Réponse acceptée

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

répondu il y a 5 mois

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions