tensorflow / tensorflow

An Open Source Machine Learning Framework for Everyone
https://tensorflow.org
Apache License 2.0
186.04k stars 74.26k forks source link

could not download Bazel: HTTP GET https://releases.bazel.build/5.1.1 #55945

Closed catqaq closed 1 year ago

catqaq commented 2 years ago
Click to expand! ### Issue Type Build/Install ### Source source ### Tensorflow Version tensorflow from your tensorflow/tensorflow:devel ### Custom Code No ### OS Platform and Distribution Ubuntu 20.04.4 LTS ### Mobile device android ### Python version 3.8 ### Bazel version no ### GCC/Compiler version gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1) ### CUDA/cuDNN version no ### GPU model and memory no cuda ### Current Behaviour? ```shell Hi, i followed your tutorial to build tensorflow and tflite in a docker. I got a network error: + bazel build -c opt --cxxopt=--std=c++14 --fat_apk_cpu=arm64-v8a,armeabi-v7a --host_crosstool_top=@bazel_tools//tools/cpp:toolchain //tmp:tensorflow-lite 2022/05/06 09:48:55 Downloading https://releases.bazel.build/5.1.1/release/bazel-5.1.1-linux-x86_64... 2022/05/06 09:49:00 could not download Bazel: HTTP GET https://releases.bazel.build/5.1.1/release/bazel-5.1.1-linux-x86_64 failed: Get "https://releases.bazel.build/5.1.1/release/bazel-5.1.1-linux-x86_64": read tcp 172.17.0.14:54726->130.211.22.235:443: read: connection reset by peer I tried to install bazel in advance, but the same problem still occurred. It seems that the bazel installed by myself did not take effect. When running the bazel command, I still tried to download bazel 5.1.1, and then failed due to network problems. /tensorflow_src# bazel 2022/05/06 09:58:01 Downloading https://releases.bazel.build/5.1.1/release/bazel-5.1.1-linux-x86_64... 2022/05/06 09:58:02 could not download Bazel: HTTP GET https://releases.bazel.build/5.1.1/release/bazel-5.1.1-linux-x86_64 failed: Get "https://releases.bazel.build/5.1.1/release/bazel-5.1.1-linux-x86_64": read tcp 172.17.0.14:54934->130.211.22.235:443: read: connection reset by peer ``` ### Standalone code to reproduce the issue ```shell 1.follow your tutorial:https://www.tensorflow.org/lite/android/lite_build#set_up_build_environment_using_docker 2.build: bash tensorflow/lite/tools/build_aar.sh --input_models=model.tflite --target_archs=arm64-v8a,armeabi-v7a ``` ### Relevant log output _No response_
mohantym commented 2 years ago

Hi @catqaq ! Error shows incomplete transaction between client and server . Can you check these the steps for installation of Bazel in this gist and Tested configuration (GCC 7.3.1) with Bazel 4.2.1 or 5.0.0 after resetting your internet connection? Thanks!

catqaq commented 2 years ago

@mohantym Hi, i followed the steps for installation of Bazel in this gist. But I got the same error as above: root@9e54466822ea:/# bazel 2022/05/06 11:27:22 Downloading https://releases.bazel.build/5.1.1/release/bazel-5.1.1-linux-x86_64... 2022/05/06 11:27:22 could not download Bazel: HTTP GET https://releases.bazel.build/5.1.1/release/bazel-5.1.1-linux-x86_64 failed: Get "https://releases.bazel.build/5.1.1/release/bazel-5.1.1-linux-x86_64": read tcp 172.17.0.14:55828->130.211.22.235:443: read: connection reset by peer

catqaq commented 2 years ago

@mohantym Hi, I re-installed bazel several times, and things are starting to change. root@9e54466822ea:/tensorflow_src# bazel /usr/local/bin/bazel: line 163: /usr/local/lib/bazel/bin/bazel-real: cannot execute binary file: Exec format error ERROR: The project you're trying to build requires Bazel 5.1.1 (specified in /tensorflow_src/.bazelversion), but it wasn't found in /usr/local/lib/bazel/bin.

Bazel binaries for all official releases can be downloaded from here: https://github.com/bazelbuild/bazel/releases

You can download the required version directly using this command: (cd "/usr/local/lib/bazel/bin" && curl -fLO https://releases.bazel.build/5.1.1/release/bazel-5.1.1-linux-x86_64 && chmod +x bazel-5.1.1-linux-x86_64)

After (cd "/usr/local/lib/bazel/bin" && curl -fLO https://releases.bazel.build/5.1.1/release/bazel-5.1.1-linux-x86_64 && chmod +x bazel-5.1.1-linux-x86_64),bazel installation seems success with some errors: root@9e54466822ea:/usr/local/lib/bazel/bin# chmod +x bazel-5.1.1-linux-x86_64 root@9e54466822ea:/usr/local/lib/bazel/bin# bazel /usr/local/bin/bazel: line 220: /usr/local/lib/bazel/bin/bazel-real: cannot execute binary file: Exec format error /usr/local/bin/bazel: line 220: /usr/local/lib/bazel/bin/bazel-real: Success

Then, I run ./configure and build tflite aar again, but failed with jdk11 related error even though I installed jdk11 by sudo apt install openjdk-11-jdk: bash tensorflow/lite/tools/build_aar.sh --input_models=model.tflite --target_archs=arm64-v8a,armeabi-v7a WARNING: Download from https://mirror.bazel.build/openjdk/azul-zulu11.50.19-ca-jdk11.0.12/zulu11.50.19-ca-jdk11.0.12-linux_x64.tar.gz failed: class javax.net.ssl.SSLException Connection reset ERROR: An error occurred during the fetch of repository 'remotejdk11_linux': Traceback (most recent call last): File "/root/.cache/bazel/_bazel_root/43801f1e35f242fb634ebbc6079cf6c5/external/bazel_tools/tools/build_defs/repo/http.bzl", line 100, column 45, in _http_archive_impl download_info = ctx.download_and_extract( Error in download_and_extract: java.io.IOException: Error downloading [https://mirror.bazel.build/openjdk/azul-zulu11.50.19-ca-jdk11.0.12/zulu11.50.19-ca-jdk11.0.12-linux_x64.tar.gz] to /root/.cache/bazel/_bazel_root/43801f1e35f242fb634ebbc6079cf6c5/external/remotejdk11_linux/temp14285363683548491890/zulu11.50.19-ca-jdk11.0.12-linux_x64.tar.gz: Connection reset ERROR: /DEFAULT.WORKSPACE.SUFFIX:41:6: fetching http_archive rule //external:remotejdk11_linux: Traceback (most recent call last): File "/root/.cache/bazel/_bazel_root/43801f1e35f242fb634ebbc6079cf6c5/external/bazel_tools/tools/build_defs/repo/http.bzl", line 100, column 45, in _http_archive_impl download_info = ctx.download_and_extract( Error in download_and_extract: java.io.IOException: Error downloading [https://mirror.bazel.build/openjdk/azul-zulu11.50.19-ca-jdk11.0.12/zulu11.50.19-ca-jdk11.0.12-linux_x64.tar.gz] to /root/.cache/bazel/_bazel_root/43801f1e35f242fb634ebbc6079cf6c5/external/remotejdk11_linux/temp14285363683548491890/zulu11.50.19-ca-jdk11.0.12-linux_x64.tar.gz: Connection reset INFO: Repository remote_java_tools instantiated at: /DEFAULT.WORKSPACE.SUFFIX:392:6: in /root/.cache/bazel/_bazel_root/43801f1e35f242fb634ebbc6079cf6c5/external/bazel_tools/tools/build_defs/repo/utils.bzl:233:18: in maybe Repository rule http_archive defined at: /root/.cache/bazel/_bazel_root/43801f1e35f242fb634ebbc6079cf6c5/external/bazel_tools/tools/build_defs/repo/http.bzl:353:31: in INFO: Repository rules_cc instantiated at: /tensorflow_src/WORKSPACE:19:14: in /tensorflow_src/tensorflow/workspace1.bzl:11:28: in workspace /root/.cache/bazel/_bazel_root/43801f1e35f242fb634ebbc6079cf6c5/external/rules_cuda/cuda/dependencies.bzl:72:18: in rules_cuda_dependencies /root/.cache/bazel/_bazel_root/43801f1e35f242fb634ebbc6079cf6c5/external/rules_cuda/cuda/dependencies.bzl:35:17: in _rules_cc Repository rule http_archive defined at: /root/.cache/bazel/_bazel_root/43801f1e35f242fb634ebbc6079cf6c5/external/bazel_tools/tools/build_defs/repo/http.bzl:353:31: in ERROR: /root/.cache/bazel/_bazel_root/43801f1e35f242fb634ebbc6079cf6c5/external/bazel_tools/tools/jdk/BUILD:29:19: @bazel_tools//tools/jdk:current_java_runtime depends on @remotejdk11_linux//:jdk in repository @remotejdk11_linux which failed to fetch. no such package '@remotejdk11_linux//': java.io.IOException: Error downloading [https://mirror.bazel.build/openjdk/azul-zulu11.50.19-ca-jdk11.0.12/zulu11.50.19-ca-jdk11.0.12-linux_x64.tar.gz] to /root/.cache/bazel/_bazel_root/43801f1e35f242fb634ebbc6079cf6c5/external/remotejdk11_linux/temp14285363683548491890/zulu11.50.19-ca-jdk11.0.12-linux_x64.tar.gz: Connection reset WARNING: Download from https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.5/platforms-0.0.5.tar.gz failed: class javax.net.ssl.SSLException Connection reset ERROR: Analysis of target '//tmp:tensorflow-lite' failed; build aborted: INFO: Elapsed time: 15.196s INFO: 0 processes. FAILED: Build did NOT complete successfully (1 packages loaded, 0 targets configured) currently loading: @local_config_cc// Fetching https://github.com/bazelbuild/java_tools/releases/download/java_v11.6/java_tools-v11.6.zip Fetching https://github.com/.../rules_cc/archive/081771d4a0e9d7d3aa0eed2ef389fa4700dfb23e.tar.gz

mohantym commented 2 years ago

Ok @catqaq ! Thanks for reporting the bug. @sachinprasadhs ! Could you please look at this issue?

catqaq commented 2 years ago

@mohantym @sachinprasadhs Hi, one more thing, why does tensorflow master branch in the container built by default docker file tflite-android.Dockerfile use bazel5.1.1 and gcc9.4.0? When switched to r2.8, required bazel version is 4.2.1. Looking forward to your help!

tensorflow-2.8.0 | 3.7-3.10 | GCC 7.3.1 | Bazel 4.2.1 -- | -- | -- | --
catqaq commented 2 years ago

@karimnosseir @sachinprasadhs @mohantym Hi, I give up to use docker and tried to build tflite aar in windows. Unfortunately, the network problem persists. Any idea to use local file instead of downloading to avoid network error? I tried to use local file, but it seems something wrong. ` http_archive( name = "io_bazel_rules_closure", sha256 = "5b00383d08dd71f28503736db0500b6fb4dda47489ff5fc6bed42557c07c6ba9", strip_prefix = "rules_closure-308b05b2419edb5c8ee0471b67a40403df940149", urls = [ "file:../tensorflow/third_party:308b05b2419edb5c8ee0471b67a40403df940149.tar.gz", "https://storage.googleapis.com/mirror.tensorflow.org/github.com/bazelbuild/rules_closure/archive/308b05b2419edb5c8ee0471b67a40403df940149.tar.gz", "https://github.com/bazelbuild/rules_closure/archive/308b05b2419edb5c8ee0471b67a40403df940149.tar.gz", # 2019-06-13 ], ) http_archive( name = "rules_pkg", sha256 = "352c090cc3d3f9a6b4e676cf42a6047c16824959b438895a76c2989c6d7c246a", urls = [ "file:../tensorflow/third_party:rules_pkg-0.2.5.tar.gz", "https://github.com/bazelbuild/rules_pkg/releases/download/0.2.5/rules_pkg-0.2.5.tar.gz", "https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.2.5/rules_pkg-0.2.5.tar.gz", ], ) http_archive( name = "llvm-raw", build_file_content = "# empty", sha256 = LLVM_SHA256, strip_prefix = "llvm-project-" + LLVM_COMMIT, urls = [ "file:///third_party:llvm-project-55c71c9eac9bc7f956a05fa9258fad4f86565450.tar.gz", ], ) tf_http_archive( name = "tf_runtime", sha256 = TFRT_SHA256, strip_prefix = "runtime-{commit}".format(commit = TFRT_COMMIT),

urls = tf_mirror_urls("https://github.com/tensorflow/runtime/archive/{commit}.tar.gz".format(commit = TFRT_COMMIT)),

    urls = ["file:../tensorflow/third_party:runtime-c3e082762b7664bbc7ffd2c39e86464928e27c0c.tar.gz"],
    # A patch file can be provided for atomic commits to both TF and TFRT.
    # The job that bumps the TFRT_COMMIT also resets patch_file to 'None'.
    patch_file = None,
)

` INFO: Found applicable config definition build:monolithic in file d:\tensorflow\tensorflow-r2.8.bazelrc: --define framework_shared_object=false ERROR: Traceback (most recent call last): File "D:/tensorflow/tensorflow-r2.8/WORKSPACE", line 11, column 14, in tf_workspace3() File "D:/tensorflow/tensorflow-r2.8/tensorflow/workspace3.bzl", line 29, column 15, in workspace tf_runtime() File "D:/tensorflow/tensorflow-r2.8/third_party/tf_runtime/workspace.bzl", line 12, column 20, in repo tf_http_archive( File "D:/tensorflow/tensorflow-r2.8/third_party/repo.bzl", line 110, column 13, in tf_http_archive fail("tf_http_archive(urls) must have redundant URLs.") Error in fail: tf_http_archive(urls) must have redundant URLs. ERROR: error loading package '': in D:/tensorflow/tensorflow-r2.8/tensorflow/workspace2.bzl: in D:/tensorflow/tensorflow-r2.8/third_party/llvm/setup.bzl: Encountered error while reading extension file 'utils/bazel/configure.bzl': no such package '@llvm-raw//utils/bazel': error loading package 'external': Could not load //external package INFO: Elapsed time: 0.115s INFO: 0 processes. FAILED: Build did NOT complete successfully (0 packages loaded)

catqaq commented 2 years ago

I also tried to build bazel from scratch, but it still Build Bazel with Bazel. So, got the network error too.

root@9e54466822ea:/bazel-4.2.1-dist# env EXTRA_BAZEL_ARGS="--tool_java_runtime_version=local_jdk" bash ./compile.sh 🍃 Building Bazel from scratch...... 🍃 Building Bazel with Bazel. DEBUG: /tmp/bazel_W5uGPzng/out/external/bazel_toolchains/rules/rbe_repo/version_check.bzl:59:14: Current running Bazel is not a release version and one was not defined explicitly in rbe_autoconfig target. Falling back to '3.1.0' DEBUG: /tmp/bazel_W5uGPzng/out/external/bazel_toolchains/rules/rbe_repo/checked_in.bzl:103:14: rbe_ubuntu1804_java11 not using checked in configs as detect_java_home was set to True DEBUG: /tmp/bazel_W5uGPzng/out/external/bazel_toolchains/rules/rbe_repo/version_check.bzl:59:14: Current running Bazel is not a release version and one was not defined explicitly in rbe_autoconfig target. Falling back to '3.1.0' DEBUG: /tmp/bazel_W5uGPzng/out/external/bazel_toolchains/rules/rbe_repo/checked_in.bzl:103:14: rbe_ubuntu1604_java8 not using checked in configs as detect_java_home was set to True INFO: Repository remotejdk11_linux instantiated at: /DEFAULT.WORKSPACE.SUFFIX:52:6: in /tmp/bazel_W5uGPzng/out/external/bazel_tools/tools/build_defs/repo/utils.bzl:201:18: in maybe Repository rule http_archive defined at: /tmp/bazel_W5uGPzng/out/external/bazel_tools/tools/build_defs/repo/http.bzl:336:31: in WARNING: Download from https://mirror.bazel.build/openjdk/azul-zulu11.37.17-ca-jdk11.0.6/zulu11.37.17-ca-jdk11.0.6-linux_x64.tar.gz failed: class java.net.SocketException Connection reset ERROR: An error occurred during the fetch of repository 'remotejdk11_linux': Traceback (most recent call last): File "/tmp/bazel_W5uGPzng/out/external/bazel_tools/tools/build_defs/repo/http.bzl", line 111, column 45, in _http_archive_impl download_info = ctx.download_and_extract( Error in download_and_extract: java.io.IOException: Error downloading [https://mirror.bazel.build/openjdk/azul-zulu11.37.17-ca-jdk11.0.6/zulu11.37.17-ca-jdk11.0.6-linux_x64.tar.gz] to /tmp/bazel_W5uGPzng/out/external/remotejdk11_linux/temp11030591926562750233/zulu11.37.17-ca-jdk11.0.6-linux_x64.tar.gz: Connection reset ERROR: Error fetching repository: Traceback (most recent call last): File "/tmp/bazel_W5uGPzng/out/external/bazel_tools/tools/build_defs/repo/http.bzl", line 111, column 45, in _http_archive_impl download_info = ctx.download_and_extract( Error in download_and_extract: java.io.IOException: Error downloading [https://mirror.bazel.build/openjdk/azul-zulu11.37.17-ca-jdk11.0.6/zulu11.37.17-ca-jdk11.0.6-linux_x64.tar.gz] to /tmp/bazel_W5uGPzng/out/external/remotejdk11_linux/temp11030591926562750233/zulu11.37.17-ca-jdk11.0.6-linux_x64.tar.gz: Connection reset ERROR: /tmp/bazel_W5uGPzng/out/external/bazel_tools/tools/jdk/BUILD:490:6: @bazel_tools//tools/jdk:remote_jdk11 depends on @remotejdk11_linux//:jdk in repository @remotejdk11_linux which failed to fetch. no such package '@remotejdk11_linux//': java.io.IOException: Error downloading [https://mirror.bazel.build/openjdk/azul-zulu11.37.17-ca-jdk11.0.6/zulu11.37.17-ca-jdk11.0.6-linux_x64.tar.gz] to /tmp/bazel_W5uGPzng/out/external/remotejdk11_linux/temp11030591926562750233/zulu11.37.17-ca-jdk11.0.6-linux_x64.tar.gz: Connection reset ERROR: Analysis of target '//src:bazel_nojdk' failed; build aborted: Analysis failed INFO: Elapsed time: 19.818s INFO: 0 processes. FAILED: Build did NOT complete successfully (333 packages loaded, 8366 targets\ configured)

ERROR: Could not build Bazel

catqaq commented 2 years ago

@karimnosseir @sachinprasadhs @mohantym Hi, Can we download all dependencies at once and load them locally? Currently I can only handle network errors for each package one by one, download the package first, and change the url to a local path, which is too time consuming.

sachinprasadhs commented 2 years ago

Hi, Did you follow this document to setup build without docker.

catqaq commented 2 years ago

Hi, of course I did, but failed for network error.

Hi, Did you follow this document to setup build without docker.

pjpratik commented 1 year ago

Hi @catqaq

I was checking if the issue still persists. Can you try with latest r2.12 version which requires Bazel 5.3.0 as per build configuration.

I have tested on arm64 with Bazel 5.3.0 and able build the tensorflow-lite.aar file without any error. Please find the screenshot below.

Screenshot 2023-04-21 at 7 32 13 PM

Thanks.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you.

github-actions[bot] commented 1 year ago

This issue was closed because it has been inactive for 7 days since being marked as stale. Please reopen if you'd like to work on this further.

google-ml-butler[bot] commented 1 year ago

Are you satisfied with the resolution of your issue? Yes No