如何解决AWS Lambda Bigquery 存储模块导入存在问题?

0

【以下的问题经过翻译处理】 你好,当我尝试在 Lambda 中导入 Bigquery_storage 模块时,遇到了以下问题。

"errorMessage": "Unable to import module 'lambda_function': cannot import name 'cygrpc' from 'grpc._cython' (/opt/python/grpc/_cython/__init__.py)",
  "errorType": "Runtime.ImportModuleError"

我已经创建了与我的 Lambda 中相同的Python runtime layer。我在 Lambda 和layer中都使用了 Python 3.9。我尝试在层包中显式安装 grpcio 模块,但没有成功。

在此之前,我创建了 Google Cloud Big Query 包,并且它正常工作。

profile picture
EXPERTO
preguntada hace 6 meses26 visualizaciones
1 Respuesta
0

【以下的回答经过翻译处理】 经过一番研究,有一篇帖子建议使用与Lambda运行时相同的操作系统来创建层。如果您查看Lambda的运行时,您会发现运行时使用的操作系统是Amazon Linux或Amazon Linux 2。 [https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html]

所以,我创建了一个虚拟机,使用Amazon Linux 2映像,并在该机器上创建了layer。现在它可以很好的运行在Lambda函数中。

profile picture
EXPERTO
respondido hace 6 meses

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas