编译tensorflow-serving错误no such package '@icu//'

完整错误信息

ERROR: /root/.cache/bazel/_bazel_root/e53bbb0b0da4e26d24b415310219b953/external/org_tensorflow/tensorflow/core/kernels/BUILD:6589:1: no such package '@icu//': java.io.IOException: Error downloading [https://mirror.bazel.build/github.com/unicode-org/icu/archive/release-62-1.tar.gz, https://github.com/unicode-org/icu/archive/release-62-1.tar.gz] to /root/.cache/bazel/_bazel_root/e53bbb0b0da4e26d24b415310219b953/external/icu/release-62-1.tar.gz: All mirrors are down: [Connection reset] and referenced by '@org_tensorflow//tensorflow/core/kernels:unicode_script_op'
ERROR: Analysis of target '//tensorflow_serving/model_servers:tensorflow_model_server' failed; build aborted: Analysis failed
INFO: Elapsed time: 17.413s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (37 packages loaded)

 

缺icu,根据错误信息知是tensorflow-serving编译时调用tensorflow组件连不上下载地址导致的

网上能找到的错误都是编译tensorflow时产生错误,所以修改目录/root/.cache/bazel/_bazel_root/e53bbb0b0da4e26d24b415310219b953/external/org_tensorflow/tensorflow下的build文件

下载icu的文件路径:

/.cache/bazel/_bazel_root/e53bbb0b0da4e26d24b415310219b953/external/org_tensorflow/third_party/icu/workspace.bzl

用vim进行编辑

"""Loads a lightweight subset of the ICU library for Unicode processing."""

load("//third_party:repo.bzl", "third_party_http_archive")

def repo():
    third_party_http_archive(
        name = "icu",
        strip_prefix = "icu-release-62-1",
        sha256 = "86b85fbf1b251d7a658de86ce5a0c8f34151027cc60b01e1b76f167379acf181",
        urls = [
"https://mirror.bazel.build/github.com/unicode-org/icu/archive/release-62-1.tar.gz",
            "http://10.32.97.118/share/icu-release-62-1.tar.gz",
        ],
        build_file = "//third_party/icu:BUILD.bazel",
    )

将release-62-1.tar.gz放到自己搭建的http服务器上,然后将地址写到这个文件中

 

 

再编译仍然出错

ERROR: /root/.cache/bazel/_bazel_root/e53bbb0b0da4e26d24b415310219b953/external/org_tensorflow/tensorflow/core/kernels/BUILD:6589:1: no such package '@icu//': java.io.IOException: Error downloading [https://mirror.bazel.build/github.com/unicode-org/icu/archive/release-62-1.tar.gz, http://10.32.97.118/share/icu-release-62-1.tar.gz] to /root/.cache/bazel/_bazel_root/e53bbb0b0da4e26d24b415310219b953/external/icu/release-62-1.tar.gz: Checksum was 86b85fbf1b251d7a658de86ce5a0c8f34151027cc60b01e1b76f167379acf181 but wanted e15ffd84606323cbad5515bf9ecdf8061cc3bf80fb883b9e6aa162e485aa9761 and referenced by '@org_tensorflow//tensorflow/core/kernels:unicode_script_op'

错误提示checksum和需要的不一致

文件中写的是86b85fbf1b251d7a658de86ce5a0c8f34151027cc60b01e1b76f167379acf181但是需要的是e15ffd84606323cbad5515bf9ecdf8061cc3bf80fb883b9e6aa162e485aa9761

将需要的checksum替换掉workspace.bzl中的sha256即可

保存修改后编译通过

 

posted @ 2021-03-02 16:01  Wangtn  阅读(1303)  评论(0编辑  收藏  举报