编译TensorFlow 2.13.0时提示下载依赖组件go_sdk失败,详细信息如下:
INFO: Repository go_sdk instantiated at: /path/to/tensorflow-2.13.0/WORKSPACE:23:14: in <toplevel> /path/to/tensorflow-2.13.0/tensorflow/workspace0.bzl:135:20: in workspace /root/.cache/bazel/_bazel_root/dcb36252f49837fd7a0e106d550e0fdb/external/com_github_grpc_grpc/bazel/grpc_extra_deps.bzl:36:27: in grpc_extra_deps /root/.cache/bazel/_bazel_root/dcb36252f49837fd7a0e106d550e0fdb/external/io_bazel_rules_go/go/private/sdk.bzl:431:28: in go_register_toolchains /root/.cache/bazel/_bazel_root/dcb36252f49837fd7a0e106d550e0fdb/external/io_bazel_rules_go/go/private/sdk.bzl:130:21: in go_download_sdk Repository rule _go_download_sdk defined at: /root/.cache/bazel/_bazel_root/dcb36252f49837fd7a0e106d550e0fdb/external/io_bazel_rules_go/go/private/sdk.bzl:117:35: in <toplevel> WARNING: Download from https://golang.org/dl/?mode=json&include=all failed: class java.io.IOException Unable to tunnel through proxy. Proxy returns "HTTP/1.1 504 Gateway Time-out" WARNING: Download from https://golang.google.cn/dl/?mode=json&include=all failed: class java.io.IOException Unable to tunnel through proxy. Proxy returns "HTTP/1.1 504 Gateway Time-out" ERROR: An error occurred during the fetch of repository 'go_sdk': Traceback (most recent call last): File "/root/.cache/bazel/_bazel_root/dcb36252f49837fd7a0e106d550e0fdb/external/io_bazel_rules_go/go/private/sdk.bzl", line 71, column 21, in _go_download_sdk_impl ctx.download( Error in download: java.io.IOException: Error downloading [https://golang.org/dl/?mode=json&include=all, https://golang.google.cn/dl/?mode=json&include=all] to /root/.cache/bazel/_bazel_root/dcb36252f49837fd7a0e106d550e0fdb/external/go_sdk/versions.json: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 504 Gateway Time-out" ERROR: /path/to/tensorflow-2.13.0/WORKSPACE:23:14: fetching _go_download_sdk rule //external:go_sdk: Traceback (most recent call last): File "/root/.cache/bazel/_bazel_root/dcb36252f49837fd7a0e106d550e0fdb/external/io_bazel_rules_go/go/private/sdk.bzl", line 71, column 21, in _go_download_sdk_impl ctx.download( Error in download: java.io.IOException: Error downloading [https://golang.org/dl/?mode=json&include=all, https://golang.google.cn/dl/?mode=json&include=all] to /root/.cache/bazel/_bazel_root/dcb36252f49837fd7a0e106d550e0fdb/external/go_sdk/versions.json: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 504 Gateway Time-out" ERROR: Analysis of target '//tensorflow/tools/pip_package:build_pip_package' failed; build aborted: java.io.IOException: Error downloading [https://golang.org/dl/?mode=json&include=all, https://golang.google.cn/dl/?mode=json&include=all] to /root/.cache/bazel/_bazel_root/dcb36252f49837fd7a0e106d550e0fdb/external/go_sdk/versions.json: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 504 Gateway Time-out" INFO: Elapsed time: 289.584s INFO: 0 processes. FAILED: Build did NOT complete successfully (298 packages loaded, 4399 targets configured)
关键错误信息:执行下载任务,访问超时。
1 | Error in download: java.io.IOException: Error downloading [https://golang.org/dl/?mode=json&include=all, https://golang.google.cn/dl/?mode=json&include=all] to /root/.cache/bazel/_bazel_root/dcb36252f49837fd7a0e106d550e0fdb/external/go_sdk/versions.json: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 504 Gateway Time-out" |
根本原因分析:无法访问https://golang.org/dl/?mode=json&include=all和https://golang.google.cn/dl/?mode=json&include=all,网络不可达。
HTTP/1.1 504 Gateway Timeout错误表示客户端发出请求后,服务器作为网关或者代理,等待了一段时间后未能从上游服务器或者后端服务器接收到响应。这种错误通常是由于上游服务器或者后端服务器的响应时间过长或者未能响应导致的。可能的原因包括网络拥堵、服务器负载过高、DNS解析问题等。
1 2 | curl https://golang.org -k curl https://golang.google.cn -k |
上图表示网络不可达。
1 2 | bazel clean bazel build //tensorflow/tools/pip_package:build_pip_package |