【问题标题】:Error changing port while trying to runn datalab for google machine learning course on google cloud尝试在谷歌云上为谷歌机器学习课程运行 datalab 时更改端口时出错
【发布时间】:2018-09-21 09:05:33
【问题描述】:

我正在尝试使用谷歌云进行机器学习课程 我按照此页面中的说明进行操作: https://github.com/google/eng-edu/blob/master/ml/cc/README.md

(在 Google Cloud 上运行 Datalab 部分)
我到了第 5 步,我必须将端口更改为 8081
我按照说明进行操作,但出现以下错误:
错误:无法连接到端口 8081 上的 Cloud Shell。
确保您的服务器正在侦听端口 8081,然后重试。
你能告诉我如何解决这个问题吗?
(我在 Windows 10 和 chrome 中工作)
谢谢,
宜兰

以下是我通过激活命令(而不是shell)激活的datalab_create.sh的结果 我激活了 3 个命令:

gcloud 服务启用计算组件
gcloud 服务启用 ml.googleapis.com
./eng-edu/ml/cc/bin/datalab_connect.sh

Welcome to Cloud Shell! Type "help" to get started.
hindy_ilan@windy-hangar-200805:~$ gcloud services enable compute_component
Waiting for async operation operations/tmo-acf.a926e02c-e264-4ec1-b136-094a9efa6916 to complete...
Operation finished successfully. The following command can describe the Operation details:
 gcloud services operations describe operations/tmo-acf.a926e02c-e264-4ec1-b136-094a9efa6916
hindy_ilan@windy-hangar-200805:~$
hindy_ilan@windy-hangar-200805:~$ gcloud services operations describe operations/tmo-acf.a926e02c-e264-4ec1-b136-094a9efa6916
done: true
metadata:
  '@type': type.googleapis.com/google.api.servicemanagement.v1.OperationMetadata
  resourceNames:
  - services/compute_component/projectSettings/921211249673
name: operations/tmo-acf.a926e02c-e264-4ec1-b136-094a9efa6916
response:
  '@type': type.googleapis.com/google.api.servicemanagement.v1.EnableServiceResponse
hindy_ilan@windy-hangar-200805:~$ gcloud services enable ml.googleapis.com
Waiting for async operation operations/tmo-acf.e8aa5fe8-fbf5-4011-b730-461255f15805 to complete...
Operation finished successfully. The following command can describe the Operation details:
 gcloud services operations describe operations/tmo-acf.e8aa5fe8-fbf5-4011-b730-461255f15805
hindy_ilan@windy-hangar-200805:~$ gcloud services operations describe operations/tmo-acf.e8aa5fe8-fbf5-4011-b730-461255f15805
done: true
metadata:
  '@type': type.googleapis.com/google.api.servicemanagement.v1.OperationMetadata
  resourceNames:
  - services/ml.googleapis.com/projectSettings/921211249673
name: operations/tmo-acf.e8aa5fe8-fbf5-4011-b730-461255f15805
response:
  '@type': type.googleapis.com/google.api.servicemanagement.v1.EnableServiceResponse
hindy_ilan@windy-hangar-200805:~$ ./eng-edu/ml/cc/bin/datalab_connect.sh
Checking Datalab VM mlccvm-hindyilan exists
ERROR: Datalab VM does not exist
hindy_ilan@windy-hangar-200805:~$

【问题讨论】:

  • 有一个github issue,发帖者提出了完全相同的问题。不过那里还有更多上下文,即一个日志文件,它指向与来自datalab_create.shgcloud service-management 命令相关的错误。你也遇到这种情况吗?总而言之,我认为您应该放弃脚本,从控制台激活 API,然后自己运行 datalab createdatalab connect 命令。
  • github 的问题是头脑。我假设谷歌在发布脚本时没有出错,也许我运行它时有问题。我认为最好的方法是清理项目并尝试再次运行它

标签: machine-learning google-cloud-platform google-cloud-datalab


【解决方案1】:

This github 问题(由 OP 提出,如 comment 所示)包括一个指向实际错误的日志文件 (ERROR: (gcloud) Invalid choice: 'service-management')。这里的问题在于 datalab_create.sh 脚本,更具体地说,是以下两行启用 Google Compute Engine 和 Cloud Machine Learning API:

gcloud service-management enable compute_component
gcloud service-management enable ml.googleapis.com

脚本已过时:service-management enable 命令已成为replaced by services enable。当我试图重现您的问题时,我收到了一条警告消息,表明了这一点。我的猜测是您没有收到该消息,因为您使用的 Cloud SDK 版本与我使用的不同。使用最新版本(截至 4 月 17 日的 197.0.0)运行会引发这些警告,但仍会启用 API。您可以通过运行gcloud version 检查您启用的版本,并通过运行gcloud components update 更新到最新版本。

第二种选择是将这两行替换为:

gcloud services enable compute_component
gcloud services enable ml.googleapis.com

【讨论】:

  • 我运行版本 198.0.0(看起来 google 取消了旧版本命令的选项)无论如何第二个选项都有效。我有一个新问题。绝望了,我使用删除命令跳跃重新开始,现在我没有虚拟机。我收到了以下消息ERROR: Datalab VM does not exist什么是摆脱这种情况的方法?
  • ./eng-edu/ml/cc/bin/datalab_connect.sh 脚本出现此错误(在您成功更正的步骤之后的一步)
  • 你能分享运行datalab_create.sh的完整输出吗?
  • 我在问题中添加了激活datalab_create.sh中的命令的日志
【解决方案2】:

以下是我发现的:
datalab_create.sh 是:

hindy_ilan@windy-hangar-200805:~$ more ./eng-edu/ml/cc/bin/datalab_create.sh
#!/bin/bash
#
# A script to create a new Datalab VM.
#
# author: psimakov@google.com (Pavel Simakov)
set -e
. "$(dirname "$0")/common.sh"
prompt_user_for_confirmation "Google Compute Engine and Cloud Machine Learning APIs will be enabled and new Datalab VM will be created."
echo "Enabling Google Compute Engine and Cloud Machine Learning APIs"
gcloud service-management enable compute_component
gcloud service-management enable ml.googleapis.com
assert_datalab_vm_does_not_exist
ensure_components
echo "Provisioning a new Datalab VM"
datalab create "${MLCC_INSTANCE}" --zone="us-central1-a" --no-connect
echo "Success!"

脚本的前 2 个命令是错误的,所以我替换了它们(根据您对命令的建议:

gcloud services enable compute_component
gcloud services enable ml.googleapis.com

我尝试激活的脚本中有第三个命令失败了,结果如下:

hindy_ilan@windy-hangar-200805:~$ datalab create "${MLCC_INSTANCE}" --zone="us-central1-a" --no-connect
Creating the network datalab-network
Creating the firewall rule datalab-network-allow-ssh
Creating the disk -pd
ERROR: (gcloud.compute.disks.create) unrecognized arguments: -pd
Usage: gcloud compute disks create DISK_NAME [DISK_NAME ...] [optional flags]
  optional flags may be  --csek-key-file | --description | --guest-os-features |
                         --help | --image | --image-family | --image-project |
                         --labels | --licenses | --require-csek-key-create |
                         --size | --source-snapshot | --type | --zone

你知道如何操作这个方法吗?
宜兰

【讨论】:

    【解决方案3】:

    成功! 我更正了 datalab_create.sh(根据您的建议)并运行它
    需要启用 API,然后再次运行脚本
    之后它工作正常 谢谢, 宜兰

    【讨论】:

      猜你喜欢
      • 2018-09-23
      • 2018-06-09
      • 1970-01-01
      • 2016-01-11
      • 2018-06-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-18
      • 2017-08-03
      相关资源
      最近更新 更多