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

Work behind a proxy #601

Closed
cuihenggang opened this issue Nov 13, 2015 · 7 comments
Closed

Work behind a proxy #601

cuihenggang opened this issue Nov 13, 2015 · 7 comments

Comments

@cuihenggang
Copy link

I'm using bazel to build an open source project, and it will download some third-party packages. My machine connects to the outside world with a proxy, and I set the "http_proxy" and "https_proxy" environment variables to use the proxy.

I find bazel is not able to download the third-party packages using my proxy. I tried manually downloading the packages using "wget" and it works. So I'm wondering how do I let bazel use a proxy?

Thanks,
Cui

@davidzchen
Copy link
Member

Duplicate of #587

@phdeniel
Copy link

Hi,

I try to compile tensorflow on F28, using Bazel 0.22 from Fedora Copr. I have http_proxy and https_proxy set and I added no_proxy to avoid having proxy on localhost.
I have the same kind of issue as this old bug from 2015 : bazel can't fetch "http_archives" but those urls are perfectly downloadable as I use curl or wget.
What should I do to have bazel taking care of my proxy and using it ? I had a look at isse #587 (which is listed above), it does not look the same.

Information about my issue:
$ bazel -h
INFO: Invocation ID: 86688149-5750-490b-b67e-c6066311487f
[bazel release 0.22.0- (@non-git)]
(...)
My proxy is 10.200.255.254:1080, I have http_proxy, https_proxy, HTTP_PROXY and HTTPS_PROXY pointing to it, no_proxy and NO_PROXY have value localhost,127.0.0.1
I really don't know what to do. It seems like the proxy setting : is misunderstood somewhere.

$ bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package
INFO: Invocation ID: 0985a21f-bb63-4b29-a866-88fc43aad11f
ERROR: error loading package '': Encountered error while reading extension file 'closure/defs.bzl': no such package '@io_bazel_rules_closure//closure': java.io.IOException: Error downloading [https://mirror.bazel.build/github.com/bazelbuild/rules_closure/archive/9889e2348259a5aad7e805547c1a0cf311cfcd91.tar.gz, https://github.com/bazelbuild/rules_closure/archive/9889e2348259a5aad7e805547c1a0cf311cfcd91.tar.gz] to /home/denielp/.cache/bazel/_bazel_denielp/6e12aebc6683fd9806aa928388c3b576/external/io_bazel_rules_closure/9889e2348259a5aad7e805547c1a0cf311cfcd91.tar.gz: All mirrors are down: [Proxy address 10.200.255.254:1080 is not a valid URL]
ERROR: error loading package '': Encountered error while reading extension file 'closure/defs.bzl': no such package '@io_bazel_rules_closure//closure': java.io.IOException: Error downloading [https://mirror.bazel.build/github.com/bazelbuild/rules_closure/archive/9889e2348259a5aad7e805547c1a0cf311cfcd91.tar.gz, https://github.com/bazelbuild/rules_closure/archive/9889e2348259a5aad7e805547c1a0cf311cfcd91.tar.gz] to /home/denielp/.cache/bazel/_bazel_denielp/6e12aebc6683fd9806aa928388c3b576/external/io_bazel_rules_closure/9889e2348259a5aad7e805547c1a0cf311cfcd91.tar.gz: All mirrors are down: [Proxy address 10.200.255.254:1080 is not a valid URL]
INFO: Elapsed time: 14.735s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
Fetching @io_bazel_rules_closure; fetching 14s

@Dobatymo
Copy link

Dobatymo commented Mar 6, 2019

Same problem here.

$ ~/bin/bazel test //tensorflow/...
ERROR: error loading package '': Encountered error while reading extension file 'closure/defs.bzl': no such package '@io_bazel_rules_closure//closure': java.io.IOException: Error downloading [https://mirror.bazel.build/github.com/bazelbuild/rules_closure/archive/9889e2348259a5aad7e805547c1a0cf311cfcd91.tar.gz, https://github.com/bazelbuild/rules_closure/archive/9889e2348259a5aad7e805547c1a0cf311cfcd91.tar.gz] to /home/xxx/.cache/bazel/_bazel_xxx/5ab65359727e8f93c592e28e0d959741/external/io_bazel_rules_closure/9889e2348259a5aad7e805547c1a0cf311cfcd91.tar.gz: All mirrors are down: [Proxy address myprivateproxy.com:8080 is not a valid URL]
ERROR: error loading package '': Encountered error while reading extension file 'closure/defs.bzl': no such package '@io_bazel_rules_closure//closure': java.io.IOException: Error downloading [https://mirror.bazel.build/github.com/bazelbuild/rules_closure/archive/9889e2348259a5aad7e805547c1a0cf311cfcd91.tar.gz, https://github.com/bazelbuild/rules_closure/archive/9889e2348259a5aad7e805547c1a0cf311cfcd91.tar.gz] to /home/xxx/.cache/bazel/_bazel_xxx/5ab65359727e8f93c592e28e0d959741/external/io_bazel_rules_closure/9889e2348259a5aad7e805547c1a0cf311cfcd91.tar.gz: All mirrors are down: [Proxy address myprivateproxy.com:8080 is not a valid URL]
INFO: Elapsed time: 14.785s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
FAILED: Build did NOT complete successfully (0 packages loaded)
    Fetching @io_bazel_rules_closure; fetching 14s

@phdeniel
Copy link

phdeniel commented Mar 6, 2019

Finally, I downloaded every "bazel package" using wget into a local directory (all in the same directory), and then I ran bazel using the --distdir= command line option. Bazel went and get the package in the "distdir" and not on the internet, through the proxy. This is no fix, this does not solve the problem, but it's a usable (but quite annoying) workaround.

@Dobatymo
Copy link

Dobatymo commented Mar 7, 2019

Related #6196

@dviettu134
Copy link

Finally, I downloaded every "bazel package" using wget into a local directory (all in the same directory), and then I ran bazel using the --distdir= command line option. Bazel went and get the package in the "distdir" and not on the internet, through the proxy. This is no fix, this does not solve the problem, but it's a usable (but quite annoying) workaround.

@phdeniel I'm building TensorFlow version 1.9, which require bazel 0.11.0 (https://www.tensorflow.org/install/source#tested_build_configurations)
But it seems that --distdir is not available for bazel 0.11.0 yet, do you have any work around of this problem for that version?

@mchenx
Copy link

mchenx commented Mar 31, 2020

build tf 2.1 with bazel 0.29.1 now... encountered this issue at the beginning because I exported http_proxy (and https_proxy) =localhost:1080, and bazel doesn't recognize it. everything works fine after I changed http_proxy and https_proxy to http://localhost:1080

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants