错误:Google Cloud AutoML无法导入库

问题描述

在Google Cloud上,完成了2部分: 1-可以预测XOR门输出的AutoML模型,可以对数据进行训练,可以成功构建,部署和测试模型。

2-要使用此模型,添加行后,我创建了一个新的Google python函数:

from google.cloud import automl_v1beta1 as automl

我遇到以下错误:

Deployment failure:
Function failed on loading user code. Error message: Code in file main.py can't be loaded.
Detailed stack trace:
Traceback (most recent call last):
File "/env/local/lib/python3.7/site-packages/google/cloud/functions/worker_v1.py",line 315,in check_or_load_user_function
_function_handler.load_user_function()
File "/env/local/lib/python3.7/site-packages/google/cloud/functions/worker_v1.py",line 190,in load_user_function
spec.loader.exec_module(main_module)
File "<frozen importlib._bootstrap_external>",line 728,in exec_module
File "<frozen importlib._bootstrap>",line 219,in _call_with_frames_removed
File "/user_code/main.py",line 2,in <module>
from google.cloud import automl_v1beta1 as automl
ImportError: cannot import name 'automl_v1beta1' from 'google.cloud' (unknown location)

我正在执行链接中的步骤:

requirement.txt文件是否有问题?有人可以帮我吗?

解决方法

在requirements.txt中,我添加了以下行: google-cloud-automl

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...