Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxy problem #281

Closed
Lr-2002 opened this issue Sep 12, 2021 · 5 comments · Fixed by #537
Closed

Proxy problem #281

Lr-2002 opened this issue Sep 12, 2021 · 5 comments · Fixed by #537
Assignees
Labels
type:feature New feature or request

Comments

@Lr-2002
Copy link

Lr-2002 commented Sep 12, 2021

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 20.04, WSL2): windows 10 21H1
  • Target (e.g. desktop cpu, android arm64): desktop cpu
  • Bazel version: 3.7.2
  • Python version: 3.9.6
  • GCC/G++ version: none
  • Unity version: has not been there
  • Android NDK version (if building for Android): none
  • Xcode version (if building for iOS): none

Describe the problem

HOW to build with proxy in socks

Steps to reproduce the issue
Provide the exact sequence of commands / steps that you executed before running into the problem.

  1. follow the mediapipe 1-6 finished
  2. run the build command python build.py build --desktop cpu --include_opencv_libs -v
    i changed the python_bin_path in build.py for it cannot read my PYTHON_BUILD_PATH

then it stucked at the fetch bazel

Full logs

INFO: Repository rules_pkg instantiated at:
  E:/work/piano_test/mediapipeunityplugin/WORKSPACE:29:13: in <toplevel>
Repository rule http_archive defined at:
  C:/_bzl/lmabuq3m/external/bazel_tools/tools/build_defs/repo/http.bzl:336:31: in <toplevel>
WARNING: Download from https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz failed: class java.io.IOException connect timed out
WARNING: Download from https://github.com/bazelbuild/rules_pkg/releases/download/0.3.0/rules_pkg-0.3.0.tar.gz failed: class java.io.IOException connect timed out
ERROR: An error occurred during the fetch of repository 'rules_pkg':
   Traceback (most recent call last):
        File "C:/_bzl/lmabuq3m/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://github.com/bazelbuild/rules_pkg/releases/download/0.3.0/rules_pkg-0.3.0.tar.gz] to C:/_bzl/lmabuq3m/external/rules_pkg/temp1616708469201675017/rules_pkg-0.3.0.tar.gz: connect timed out
ERROR: no such package '@rules_pkg//': java.io.IOException: Error downloading [https://github.com/bazelbuild/rules_pkg/releases/download/0.3.0/rules_pkg-0.3.0.tar.gz] to C:/_bzl/lmabuq3m/external/rules_pkg/temp1616708469201675017/rules_pkg-0.3.0.tar.gz: connect timed out
INFO: Elapsed time: 74.868s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
Traceback (most recent call last):
  File "E:\work\piano_test\MediaPipeUnityPlugin\build.py", line 395, in <module>
    Argument().command().run()
  File "E:\work\piano_test\MediaPipeUnityPlugin\build.py", line 110, in run
    self._run_command(self._build_proto_srcs_commands())
  File "E:\work\piano_test\MediaPipeUnityPlugin\build.py", line 52, in _run_command
    return subprocess.run(command_list, check=True)
  File "C:\Users\ASUS\anaconda3\envs\mediapipe\lib\subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['bazel', '--output_user_root', 'C:/_bzl', 'build', '-c', 'opt', '--action_env', 'PYTHON_BIN_PATH=C://Users//ASUS//anaconda3//envs//mediapipe//python.exe', '//mediapipe_api:mediapipe_proto_srcs']' returned non-zero exit status 1.

Additional context
Add any other context about the problem here.

I KNOW the reason but cannot fix it
👍 [reason] I 'm from china using the clash proxy
and the py ran the bazel ---- while in my former command
i use the

bazel --host_jvm_args "-DsocksProxyHost=127.0.0.1" --host_jvm_args "-DsocksProxyPort=7890" build -c opt --define MEDIAPIPE_DISABLE_GPU=1 --action_env PYTHON_BIN_PATH="C:\\Users\\ASUS\\anaconda3\\envs\\mediapipe\\python.exe" mediapipe/examples/desktop/hand_tracking:hand_tracking_cpu

using the proxy
so how to use it in the build.py?

@homuler
Copy link
Owner

homuler commented Sep 12, 2021

At the moment, it is not possible to pass arbitrary options to bazel, so please update this line.

commands += ['build', '-c', self.compilation_mode]

@Lr-2002
Copy link
Author

Lr-2002 commented Sep 12, 2021

sorry i do not understand you very well
this is my command line in your help

 python build.py build --desktop cpu --include_opencv_libs -v -c --host_jvm_args "-DsocksProxyHost=127.0.0.1" --host_jvm_args "-DsocksProxyPort=7890" 

and the python file: in 185 rows

commands += ['build', '-c', self.compilation_mode]

it still not work
build.py build: error: argument --compilation_mode/-c: expected one argument

@homuler
Copy link
Owner

homuler commented Sep 12, 2021

I mean, try updating it as follows.

diff --git a/build.py b/build.py
index ff6f0de..0691a52 100644
--- a/build.py
+++ b/build.py
@@ -179,7 +179,7 @@ class BuildCommand(Command):
     return self.system == 'Windows'
 
   def _build_common_commands(self):
-    commands = ['bazel']
+    commands = ["bazel", "--host_jvm_args", "\"-DsocksProxyHost=127.0.0.1\"", "--host_jvm_args", "\"-DsocksProxyPort=7890\""]
 
     if self._is_windows():
       # limit the path length for Windows

@Lr-2002
Copy link
Author

Lr-2002 commented Sep 12, 2021

Well ,sorry for bothering ,the problem seem to be settled (showings successfully and then i stucked at nuget (i'll settle it later))but i do not know the reason
trying clean and rebuild for twice ,problem settled.

and I 've just tried your suggestions ,it still don't work with

subprocess.CalledProcessError: Command '['bazel', '--host_jvm_args', '"-DsocksProxyHost=127.0.0.1"', '--host_jvm_args', '"-DsocksProxyPort=7890"', '--output_user_root', 'C:/_bzl', 'build', '-c', 'opt', '--action_env', 'PYTHON_BIN_PATH=C://Users//ASUS//anaconda3//envs//mediapipe//python.exe', '//mediapipe_api:mediapipe_proto_srcs']' returned non-zero exit status 37.

@homuler
Copy link
Owner

homuler commented Sep 12, 2021

Please always share all the logs, because we can't tell by looking at just the last line of the log.
Maybe escaped double quotations are not needed.

commands = ["bazel", "--host_jvm_args", "-DsocksProxyHost=127.0.0.1", "--host_jvm_args", "-DsocksProxyPort=7890"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants