Skip to content

如何解决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 包,并且它正常工作。

EXPERT

asked 3 years ago169 views

1 Answer
0

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

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

EXPERT

answered 3 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.