我知道这不是新问题,但是在尝试从源代码编译张量流时遇到了很多麻烦。看来这是“代理背后的障碍”问题。
master
我在HTTP / HTTPS代理后面工作。该环境已设置http_proxy / https_proxy(通过/etc/environment
,因此每个人都可以获取envvar)。对于测试,我将envvar设置为小写和大写。可以通过此代理使用git / https,yum或wget,因为已设置了这些envvar。
在编译tensorflow时(在./configure
步骤之后),我得到一个显式的HTTP错误:
[user22@vm0 tensorflow]$ bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package
ERROR: error loading package '': Encountered error while reading extension file 'closure/defs.bzl': no such package '@io_bazel_rules_closure//closure': Error downloading [https://mirror.bazel.build/github.com/bazelbuild/rules_closure/archive/dbb96841cc0a5fb2664c37822803b06dab20c7d1.tar.gz, https://github.com/bazelbuild/rules_closure/archive/dbb96841cc0a5fb2664c37822803b06dab20c7d1.tar.gz] to /home/user22/.cache/bazel/_bazel_user22/673c993ff8d0b73d5fcaf03ddf761476/external/io_bazel_rules_closure/dbb96841cc0a5fb2664c37822803b06dab20c7d1.tar.gz: All mirrors are down: ***[Unable to tunnel through proxy. Proxy returns "HTTP/1.1 502 Bad Gateway"]***
ERROR: error loading package '': Encountered error while reading extension file 'closure/defs.bzl': no such package '@io_bazel_rules_closure//closure': Error downloading [https://mirror.bazel.build/github.com/bazelbuild/rules_closure/archive/dbb96841cc0a5fb2664c37822803b06dab20c7d1.tar.gz, https://github.com/bazelbuild/rules_closure/archive/dbb96841cc0a5fb2664c37822803b06dab20c7d1.tar.gz] to /home/user22/.cache/bazel/_bazel_user22/673c993ff8d0b73d5fcaf03ddf761476/external/io_bazel_rules_closure/dbb96841cc0a5fb2664c37822803b06dab20c7d1.tar.gz: All mirrors are down: ***[Unable to tunnel through proxy. Proxy returns "HTTP/1.1 502 Bad Gateway"]***
INFO: Elapsed time: 14.841s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
问题显然是此HTTP / 1.1 502错误。我知道其他人在代理后面使用bazel时遇到问题,但是我没有找到对此HTTP错误的引用。关于如何解决此问题的任何想法吗?
答案 0 :(得分:0)
“ 502错误的网关”错误通常表示bazel要求代理执行不允许执行的操作-特别是,bazel不会直接向代理发出GET请求,而是直接要求CONNECT命令(参见strace):
sendto(220, "CONNECT mirror.bazel.build:443 HTTP/1.1\r\nUser-Agent: Java/1.8.0_181\r\nHost: mirror.bazel.build\r\nAccept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2\r\nProxy-Connection: keep-alive\r\n\r\n", 189, 0, NULL, 0 <unfinished ...>
您的代理配置需要更新以允许使用CONNECT命令。
或者,有些bazel github issues表示您可以查看错误并自己下载内容,但这似乎并没有很好地结束。