bazel icon indicating copy to clipboard operation
bazel copied to clipboard

tensorflow building issue on ubuntu 14.04: Accessing remote repository through a proxy

Open lacartelacarte opened this issue 11 years ago • 87 comments

As (https://github.com/tensorflow/tensorflow/issues/67) is declared as Bazel issue I'm writing here. So I'm having the same issue with the original post. As mentioned in the original post, by manually wget and placing the jpeg library the error message about jpeg has gone. However there are still many error messages, and by trying multiple times the error message seems to change but always fails with downloading something. These are the variations.

Variation 1: ERROR: /home/name/work/tensorflow/tensorflow/core/platform/default/build_config/BUILD:36:1: no such package '@re2//': https://github.com/google/re2.git: cannot open git-upload-pack and referenced by '//tensorflow/core/platform/default/build_config:platformlib'.

Variation 2: ERROR: /home/name/work/tensorflow/tensorflow/core/platform/default/build_config/BUILD:36:1: no such package '@png_archive//': Error downloading from https://storage.googleapis.com/libpng-public-archive/libpng-1.2.53.tar.gz to /home/name/.cache/bazel/_bazel_name/894ee6ce07893c5c665fe600d592867f/external/png_archive: Error downloading https://storage.googleapis.com/libpng-public-archive/libpng-1.2.53.tar.gz to /home/name/.cache/bazel/_bazel_name/894ee6ce07893c5c665fe600d592867f/external/png_archive/libpng-1.2.53.tar.gz: storage.googleapis.com and referenced by '//tensorflow/core/platform/default/build_config:platformlib'.

Variation 3: ERROR: /home/name/work/tensorflow/tensorflow/tensorflow.bzl:224:3: no such package '@gemmlowp//': https://github.com/google/gemmlowp.git: cannot open git-upload-pack and referenced by '//tensorflow/core:kernels'.

lacartelacarte avatar Nov 11 '15 06:11 lacartelacarte

Wow, do you have special network configuration? It seems like it cannot fetch remote dependencies.

@kchodorow @davidzchen might have more idea on the problem source.

damienmg avatar Nov 12 '15 09:11 damienmg

@damienmg Thank you for reply. Yes it seems to be network problem. My working machine is behind a proxy but I think I have correct setting to pass it. At least I could manually wget the jpeg library without problem. I'll check with each of the libraries mentioned in the error message when I have access to the machine tomorrow, but I think there won't be much problem by manual wget. Does Bazel need special setting for proxy?

lacartelacarte avatar Nov 12 '15 11:11 lacartelacarte

Oops assigning to Kristina then

damienmg avatar Nov 12 '15 11:11 damienmg

FYI, I'm having the same issue behind a proxy set as http://site.com:port (same for https).

  • I'm using Centos 6.7
  • Proxy settings for both HTTP_PROXY and HTTPS_PROXY are set (and lowercase versions)
  • If I download the files for new_http_archive the same issue appears for git_repository
  • Global config for proxy is set for git

jgbos avatar Nov 12 '15 14:11 jgbos

Unfortunately, there is no support at the moment for fetching external resources through a proxy. It looks like we'd want to add a mechanism to specify local settings, which I don't think Bazel has at the moment.

kchodorow avatar Nov 12 '15 16:11 kchodorow

Just confirmed I can git clone and wget those resources without problem, but fails with Bazel. Are there any work around to let Bazel use the system's proxy setting?

lacartelacarte avatar Nov 13 '15 00:11 lacartelacarte

No (although we should add that!), but you should be able to change your WORKSPACE file to local_repository() or new_local_repository() once they're downloaded to your local machine (see http://bazel.io/docs/be/workspace.html#local_repository, http://bazel.io/docs/be/workspace.html#new_local_repository).

kchodorow avatar Nov 13 '15 00:11 kchodorow

Got it. Thank you for the information. So the current best practice would be:

  1. try building
  2. read error message for missing library
  3. download it and keep it somewhere (as local repository)
  4. goto 1 until no error appears I'll try this later maybe.

lacartelacarte avatar Nov 13 '15 00:11 lacartelacarte

Does java.net.URL use the proxy settings?

ulfjack avatar Nov 13 '15 12:11 ulfjack

Java seems to support HTTP(S) proxies transparently: https://docs.oracle.com/javase/7/docs/api/java/net/doc-files/net-properties.html

We should make sure that our fetching code works with them (I haven't tried whether it does) and optionally on server start-up check whether these variables are empty, but the usual environment variables are set (HTTP_PROXY, HTTPS_PROXY) and then set the Java properties correctly from that.

philwo avatar Nov 15 '15 10:11 philwo

Hi, After using local_repository() for libpng, jpegsrc, re2 and gemmlowp packages, the earlier proxy issue went away, but the build is now failing due to 'cycle in dependency graph', as shown below:

$ bazel build -c opt //tensorflow/cc:tutorials_example_trainer Extracting Bazel installation... ....... ERROR: /home/ssaharo/.cache/bazel/_bazel_ssaharo/64bf5fcc928610d1fc32c86de697b420/external/png_archive/BUILD:23:1: in genrule rule @png_archive//:configure: cycle in dependency graph: //tensorflow/cc:tutorials_example_trainer //tensorflow/core:tensorflow //tensorflow/core:tensorflow_opensource //tensorflow/core:core //tensorflow/core:core_cpu //tensorflow/core:framework //tensorflow/core:lib //tensorflow/core/platform/default/build_config:platformlib @png_archive//:png

  • @png_archive//:configure [self-edge]. ERROR: Loading of target '//tensorflow/cc:tutorials_example_trainer' failed; build aborted. ERROR: Loading failed; build aborted.

srsaharoy avatar Nov 17 '15 23:11 srsaharoy

met the same problem as @srsaharoy ...

zhanmusi1207 avatar Nov 18 '15 06:11 zhanmusi1207

If I change the 'genrule' parameters in png.BUILD and jpeg.BUILD to specifically include "." as follows

from:

genrule( name = "configure", srcs = glob(

["*/"],

to:

genrule( name = "configure", srcs = glob(

["/."],

then the build no longer fails with error "cycle in dependency graph"

However, now it fails because it can't find a source file (which does exist!) in either libpng-1.2.53 or jpeg-9a directory path. New error message is below which says that it could not find "libpng-1.2.53/pngpread.c". I also do not understand how or who is generating signal 15 (sigterm) - is it generated because one thread of build process failed due to missing file? I did execute "bazel clean --expunge" before starting the build...

$ bazel build -c opt //tensorflow/cc:tutorials_example_trainer ...... INFO: Found 1 target... ERROR: missing input file '@png_archive//:libpng-1.2.53/pngpread.c'. ERROR: /home/ssaharo/tensorflow/tensorflow/cc/BUILD:28:1: Creating runfiles tree bazel-out/host/bin/tensorflow/cc/ops/array_ops_gen_cc.runfiles [for host] failed: build-runfiles failed: error executing command /home/ssaharo/.cache/bazel/_bazel_ssaharo/64bf5fcc928610d1fc32c86de697b420/tensorflow/_bin/build-runfiles bazel-out/host/bin/tensorflow/cc/ops/array_ops_gen_cc.runfiles_manifest ... (remaining 1 argument(s) skipped): com.google.devtools.build.lib.shell.AbnormalTerminationException: Process terminated by signal 15; also encountered an error while attempting to retrieve output. ERROR: /home/ssaharo/.cache/bazel/_bazel_ssaharo/64bf5fcc928610d1fc32c86de697b420/external/png_archive/BUILD:33:1: @png_archive//:png: missing input file '@png_archive//:libpng-1.2.53/pngpread.c'. Target //tensorflow/cc:tutorials_example_trainer failed to build Use --verbose_failures to see the command lines of failed build steps. ERROR: /home/ssaharo/.cache/bazel/_bazel_ssaharo/64bf5fcc928610d1fc32c86de697b420/external/png_archive/BUILD:33:1 1 input file(s) do not exist.

srsaharoy avatar Nov 18 '15 19:11 srsaharoy

sorry, somehow made a typo while posting: the change was from "/*" to "/."

srsaharoy avatar Nov 18 '15 19:11 srsaharoy

I tried the 'read error -> download lib -> set local repository' loop. After fixing these reference issues I could build tensorflow with bazel without problem. My protobuf's version was old and this became a problem when I tried to import tensorflow in python, but by replacing protobuf with >= 3.0 this problem is fixed and so finally I can test some network with tensorflow.

lacartelacarte avatar Nov 19 '15 07:11 lacartelacarte

could anyone who succeeded to overcome this problem post their changes to the WORKSPACE file?

uriv avatar Nov 23 '15 12:11 uriv

See issue #623 srsaharoy posted a WORKSPACE file (which only trouble is the circular dependencies and the fix is in the bug report).

We should probably provide a WORKSPACE + shell script to work around that bug.

damienmg avatar Nov 23 '15 12:11 damienmg

Thanks. I added a summary of the fix to that issue (https://github.com/bazelbuild/bazel/issues/623#issuecomment-158151936).

uriv avatar Nov 23 '15 16:11 uriv

Note, the posted WORKSPACE file only gets you past building the tensorflow tutorials_example_trainer. If you want to rebuild the whole package and install, for example to create a new TensorFlow user operator, there are no less than 74 external dependencies to manually download and edit in your WORKSPACE file...(mostly needed for TensorBoard). This is not very workable for those of us trying to build TensorFlow from behind a corporate firewall.

kbrems avatar Dec 08 '15 00:12 kbrems

Has the code fix in 5fd83b2 been tested? It doesn't seem to work for me after I build bazel from source and use that to do my tensorflow build. I've set the $HTTP_PROXY and $HTTPS_PROXY env vars with my proxy info http://me:[email protected]:8000 (scrubbed to protect the innocent). I get an error message like this:

/Users/me/Dev/tensorflow/tensorflow/third_party/eigen3/BUILD:3:1: no such package '@eigen_archive//': Error downloading from https://bitbucket.org/eigen/eigen/get/3.3-beta1.tar.gz to /private/var/tmp/_bazel_me/7c952997242db15a11242e48dacb764f/external/eigen_archive: Error downloading https://bitbucket.org/eigen/eigen/get/3.3-beta1.tar.gz to /private/var/tmp/_bazel_me/7c952997242db15a11242e48dacb764f/external/eigen_archive/3.3-beta1.tar.gz: http://me:[email protected] and referenced by '//third_party/eigen3:eigen3'.

Not sure why the proxy hostname is being printed out in the error (shouldn't do this since it contains credentials). Also the proxy port is stripped from that error message so not sure if that's an issue or not.

I've glanced through the Java code on commit 5fd83b2 and don't see any immediate issues but I admittedly don't know much about the rest of the code around the HttpDownloader class.

Using bazel 0.1.2 from the installer (which does not have proxy support) results in this error message: /Users/me/Dev/tensorflow/tensorflow/third_party/eigen3/BUILD:3:1: no such package '@eigen_archive//': Error downloading from https://bitbucket.org/eigen/eigen/get/3.3-beta1.tar.gz to /private/var/tmp/_bazel_me/7c952997242db15a11242e48dacb764f/external/eigen_archive: Error downloading https://bitbucket.org/eigen/eigen/get/3.3-beta1.tar.gz to /private/var/tmp/_bazel_me/7c952997242db15a11242e48dacb764f/external/eigen_archive/3.3-beta1.tar.gz: Connection refused and referenced by '//third_party/eigen3:eigen3'.

Any thoughts?

flawless2011 avatar Jan 05 '16 16:01 flawless2011