MediaPipeUnityPlugin icon indicating copy to clipboard operation
MediaPipeUnityPlugin copied to clipboard

shutil.ReadError: bazel-bin\mediapipe_api\mediapipe_proto_srcs.zip is not a zip file

Open mgarbade opened this issue 3 years ago • 2 comments

Plugin Version or Commit ID

d70c6f32c61ef4a199f04c580e75337038e746be

Unity Version

2020.3.26f1

Your Host OS

Windows 10 Pro

Target Platform

UnityEditor

[Windows Only] Visual Studio C++ and Windows SDK Version

Visual Studio Community 2016, Update 16.11.16 Windows SDK: 10.0.19041.0 Windows SDK: 10.0.16299.0

-> not sure which c++ compiler is used / installed

[Linux Only] GCC/G++ and GLIBC Version

No response

[Android Only] Android Build Tools and NDK Version

No response

[iOS Only] XCode Version

No response

Command Sequences

I simply ran the build command inside cmd:

python build.py build --desktop cpu --opencv=cmake -v 

Log

D:\Git\mpup_v13_220705>python build.py build --desktop cpu --opencv=cmake -v 
INFO (build.py): Building protobuf sources...
DEBUG (build.py): Running `bazel --output_user_root C:/_bzl build -c opt --action_env PYTHON_BIN_PATH="D://Programs//python39//python.exe" --action_env ProgramData --action_env PROCESSOR_ARCHITECTURE --action_env PROCESSOR_IDENTIFIER --action_env PROCESSOR_LEVEL --action_env PROCESSOR_REVISION //mediapipe_api:mediapipe_proto_srcs`
2022/07/05 12:23:43 Downloading https://releases.bazel.build/5.2.0/release/bazel-5.2.0-windows-x86_64.exe...
Extracting Bazel installation...
Starting local Bazel server and connecting to it...
WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/tensorflow/runtime/archive/2f6de37d68a4c69e2ff9eec3cebbf1369e496940.tar.gz failed: class java.io.FileNotFoundException GET returned 404 Not Found
DEBUG: C:/_bzl/5laulzlv/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'com_google_absl' because it already exists.
DEBUG: C:/_bzl/5laulzlv/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'com_google_benchmark' because it already exists.
DEBUG: C:/_bzl/5laulzlv/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'pybind11_bazel' because it already exists.
DEBUG: C:/_bzl/5laulzlv/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'com_google_protobuf' because it already exists.
DEBUG: C:/_bzl/5laulzlv/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'com_google_googletest' because it already exists.
DEBUG: C:/_bzl/5laulzlv/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'com_github_gflags_gflags' because it already exists.
DEBUG: C:/_bzl/5laulzlv/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'rules_python' because it already exists.
DEBUG: C:/_bzl/5laulzlv/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'build_bazel_rules_apple' because it already exists.
DEBUG: C:/_bzl/5laulzlv/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'rules_python' because it already exists.
DEBUG: C:/_bzl/5laulzlv/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'build_bazel_rules_apple' because it already exists.
DEBUG: C:/_bzl/5laulzlv/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'build_bazel_rules_swift' because it already exists.
DEBUG: C:/_bzl/5laulzlv/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'build_bazel_apple_support' because it already exists.
DEBUG: C:/_bzl/5laulzlv/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'xctestrunner' because it already exists.
DEBUG: C:/_bzl/5laulzlv/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'build_bazel_rules_swift' because it already exists.
DEBUG: C:/_bzl/5laulzlv/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'build_bazel_apple_support' because it already exists.
DEBUG: C:/_bzl/5laulzlv/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'xctestrunner' because it already exists.
DEBUG: C:/_bzl/5laulzlv/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'pybind11' because it already exists.
DEBUG: Rule 'rules_cc' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = "73106859751c2bc314861adc136d5cbecee3f7ae7d05539dc8235efbf4efdcbe"
DEBUG: C:/_bzl/5laulzlv/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'pybind11' because it already exists.
DEBUG: Rule 'rules_cc' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = "73106859751c2bc314861adc136d5cbecee3f7ae7d05539dc8235efbf4efdcbe"
DEBUG: Repository rules_cc instantiated at:
  D:/git/mpup_v13_220705/WORKSPACE:90:13: in <toplevel>
Repository rule http_archive defined at:
DEBUG: Repository rules_cc instantiated at:
  D:/git/mpup_v13_220705/WORKSPACE:90:13: in <toplevel>
Repository rule http_archive defined at:
  C:/_bzl/5laulzlv/external/bazel_tools/tools/build_defs/repo/http.bzl:353:31: in <toplevel>
  C:/_bzl/5laulzlv/external/bazel_tools/tools/build_defs/repo/http.bzl:353:31: in <toplevel>
INFO: Analyzed target //mediapipe_api:mediapipe_proto_srcs (96 packages loaded, 1244 targets configured).
INFO: Found 1 target...
WARNING: failed to create one or more convenience symlinks for prefix 'bazel-':
  cannot create symbolic link bazel-bin -> C:/_bzl/5laulzlv/execroot/mediapipe_api/bazel-out/x64_windows-opt/bin:  Cannot create junction (name=D:\git\mpup_v13_220705\bazel-bi-bin, target=C:\_bzl\5laulzlv\execroot\mediapipe_api\bazel-out\x64_windows-opt\bin): ERROR: src/main/native/windows/file-jni.cc(99): nativeCreateJunction(\\?\D:\git\mpup_v12073_220705\bazel-bin, \\?\C:\_bzl\5laulzlv\execroot\mediapipe_api\bazel-out\x64_windows-opt\bin): ERROR: src/main/native/windows/file.cc(401): DeviceIoControl(\\?\D:\git\mpup207_v13_220705\bazel-bin): Incorrect function.

  cannot create symbolic link bazel-testlogs -> C:/_bzl/5laulzlv/execroot/mediapipe_api/bazel-out/x64_windows-opt/testlogs:  Cannot create junction (name=D:\git\mpup_v13_220700705\bazel-testlogs, target=C:\_bzl\5laulzlv\execroot\mediapipe_api\bazel-out\x64_windows-opt\testlogs): ERROR: src/main/native/windows/file-jni.cc(99): nativeCreateJunctio\?\n(\\?\D:\git\mpup_v13_220705\bazel-testlogs, \\?\C:\_bzl\5laulzlv\execroot\mediapipe_api\bazel-out\x64_windows-opt\testlogs): ERROR: src/main/native/windows/file.cc(401): DoCoeviceIoControl(\\?\D:\git\mpup_v13_220705\bazel-testlogs): Incorrect function.

  cannot create symbolic link bazel-out -> C:/_bzl/5laulzlv/execroot/mediapipe_api/bazel-out:  Cannot create junction (name=D:\git\mpup_v13_220705\bazel-out, target=C:\_bzl\5l\5laulzlv\execroot\mediapipe_api\bazel-out): ERROR: src/main/native/windows/file-jni.cc(99): nativeCreateJunction(\\?\D:\git\mpup_v13_220705\bazel-out, \\?\C:\_bzl\5laulzlvecr\execroot\mediapipe_api\bazel-out): ERROR: src/main/native/windows/file.cc(401): DeviceIoControl(\\?\D:\git\mpup_v13_220705\bazel-out): Incorrect function.

  cannot create symbolic link bazel-mpup_v13_220705 -> C:/_bzl/5laulzlv/execroot/mediapipe_api:  Cannot create junction (name=D:\git\mpup_v13_220705\bazel-mpup_v13_220705, tar
target=C:\_bzl\5laulzlv\execroot\mediapipe_api): ERROR: src/main/native/windows/file-jni.cc(99): nativeCreateJunction(\\?\D:\git\mpup_v13_220705\bazel-mpup_v13_220705, \\?\_bzC:\_bzl\5laulzlv\execroot\mediapipe_api): ERROR: src/main/native/windows/file.cc(401): DeviceIoControl(\\?\D:\git\mpup_v13_220705\bazel-mpup_v13_220705): Incorrect function   .
Target //mediapipe_api:mediapipe_proto_srcs up-to-date:
  C:/_bzl/5laulzlv/execroot/mediapipe_api/bazel-out/x64_windows-opt/bin/mediapipe_api/mediapipe_proto_srcs.zip
INFO: Elapsed time: 301.474s, Critical Path: 49.17s
INFO: 340 processes: 12 internal, 328 local.
INFO: Build completed successfully, 340 total actions
DEBUG (build.py): Unarchiving 'bazel-bin\mediapipe_api\mediapipe_proto_srcs.zip' to 'build\Scripts\Protobuf'...
Traceback (most recent call last):
  File "D:\Git\mpup_v13_220705\build.py", line 469, in <module>
    Argument().command().run()
  File "D:\Git\mpup_v13_220705\build.py", line 113, in run
    self._unzip(
  File "D:\Git\mpup_v13_220705\build.py", line 96, in _unzip
    shutil.unpack_archive(source, dest)
  File "D:\Programs\python39\lib\shutil.py", line 1260, in unpack_archive
    func(filename, extract_dir, **kwargs)
  File "D:\Programs\python39\lib\shutil.py", line 1159, in _unpack_zipfile
    raise ReadError("%s is not a zip file" % filename)
shutil.ReadError: bazel-bin\mediapipe_api\mediapipe_proto_srcs.zip is not a zip file

D:\Git\mpup_v13_220705>
D:\Git\mpup_v13_220705>
D:\Git\mpup_v13_220705>
D:\Git\mpup_v13_220705>ls bazel-bin\mediapipe_api\mediapipe_proto_srcs.zip
ls: cannot access 'bazel-bin\mediapipe_api\mediapipe_proto_srcs.zip': No such file or directory

D:\Git\mpup_v13_220705>ls bazel-bin\mediapipe_api\mediapipe_proto_srcs
ls: cannot access 'bazel-bin\mediapipe_api\mediapipe_proto_srcs': No such file or directory

Additional Context

I successfully compiled a Windows version of the plugin two months earlier, so I'm assuming that my Windows build environment is set-up correctly, since I don't remember changing anything.

I have some hunches to where the error might come from:

  1. some required tensorflow commit has disappeared from github as mentioned by this Warning:
WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/tensorflow/runtime/archive/2f6de37d68a4c69e2ff9eec3cebbf1369e496940.tar.gz failed: class java.io.FileNotFoundException GET returned 404 Not Found
  1. Windows is unable to create symbolic links (for whatever reason) as mentioned by this Warning:
WARNING: failed to create one or more convenience symlinks for prefix 'bazel-':
  cannot create symbolic link bazel-bin -> C:/_bzl/5laulzlv/execroot/mediapipe_api/bazel-out/x64_windows-opt/bin:
  1. I assume the final error shutil.ReadError: bazel-bin\mediapipe_api\mediapipe_proto_srcs.zip is not a zip file is a result from one of the two above mentioned Warnings. Also, I noticed when recently compiling pure mediapipe in a linux environment, that the latest mediapipe requires g++ version 8 and not g++ version 7 anymore. However I'm not sure if that is the problem here, as I cannot really see which compiler is used during the build on Windows 10

mgarbade avatar Jul 05 '22 13:07 mgarbade

Maybe the same as #549.

Is there bazel-* folders under the project root? If so, remove it.

homuler avatar Jul 05 '22 14:07 homuler

meanwhile it is working again. I applied two fixes (not sure if one or both did the trick)

  1. Used VisualStudio 2022 instead of 2019 to compile the project. To specify the version I added a system environment variable BAZEL_VC with the value path\to\my\MicrosoftVisualStudio\2022\Community\VC
  2. I copied the source code from partition D:\ to the system partition C:\ which might have caused the above mentioned "symlink problem", according to this thread, quote:

Add /D to all cmd CD calls, this makes CD change drive as well as directory

mgarbade avatar Jul 05 '22 15:07 mgarbade