Bazel建立代理

时间:2018-09-13 10:10:45

标签: tensorflow proxy bazel

我想遵循tensorflow示例构建generate_streaming_test_wav来生成测试wav。我的bazel版本是0.16.1。

问题是当我使用命令bazel run tensorflow/examples/speech_commands:generate_streaming_test_wav 时,出现以下错误消息:

xxx@xxx:~/kws/tensorflow-0911$ bazel run tensorflow/examples/speech_commands:generate_streaming_test_wav
Starting local Bazel server and connecting to it...
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/janet/.cache/bazel/_bazel_janet/2d14dc1ff5782da202e00efcc3cd86bc/external/io_bazel_rules_closure/dbb96841cc0a5fb2664c37822803b06dab20c7d1.tar.gz: All mirrors are down: []
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/janet/.cache/bazel/_bazel_janet/2d14dc1ff5782da202e00efcc3cd86bc/external/io_bazel_rules_closure/dbb96841cc0a5fb2664c37822803b06dab20c7d1.tar.gz: All mirrors are down: []
INFO: Elapsed time: 57.573s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
FAILED: Build did NOT complete successfully (0 packages loaded)

但是,我可以使用wget下载这两个软件包。 1。https://mirror.bazel.build/github.com/bazelbuild/rules_closure/archive/dbb96841cc0a5fb2664c37822803b06dab20c7d1.tar.gz 2。https://github.com/bazelbuild/rules_closure/archive/dbb96841cc0a5fb2664c37822803b06dab20c7d1.tar.gz 我认为我的网络应该没问题。我不知道为什么它不能下载那些文件。

任何想法或建议将不胜感激!

3 个答案:

答案 0 :(得分:1)

如果您知道自己的代理服务器,则应该能够进行以下设置:

export HTTPS_PROXY=http://me:mypassword@myproxyserver.domain.com:myport
export HTTP_PROXY=http://me:mypassword@myproxyserver.domain.com:myport

并再次运行bazel构建。

如果您不知道wget使用的代理服务器,请检查/ etc / wgetrc或〜/ .wgetrc

我已经看到有关HTTPS_PROXY和HTTP_PROXY是大写和小写的矛盾声明,因此您可以尝试同时设置两者。 (有些使用unset删除小写设置。请参见:https://github.com/bazelbuild/bazel/issues/587#issuecomment-412531604

答案 1 :(得分:1)

这可能是Bazel储存库规则中的错误。如果您对file a bug如此友善,那就太好了!

作为一种解决方法,将下载的存档解压缩到某处,并用指向您将存档解压缩到的目录的io_bazel_rules_closure规则替换WORKSPACE文件中的local_repository规则。

答案 2 :(得分:1)

创建一个名为“ dist”的文件夹。

现在所有URL bazel都无法下载。 请在该文件夹中添加wget。 (wget通常适用于大多数代理)

然后运行

'bazel build ...... --distdir  dist'

它将从dist获取软件包,然后开始编译。