bazel icon indicating copy to clipboard operation
bazel copied to clipboard

Can't build TensorFlow from source

Open FabHan opened this issue 11 years ago • 15 comments

Related issue: https://github.com/bazelbuild/bazel/issues/586

I installed bazel 0.1.1 but still cannot build TensorFlow for a different reason.

➜  tensorflow git:(master) ✗ bazel version
Build label: 0.1.1-jdk7
Build target: bazel-out/local_linux-fastbuild/bin/src/main/java/bazel-main_deploy.jar
Build time: Thu Oct 15 20:35:27 2015 (1444941327)
Build timestamp: 1444941327
Build timestamp as int: 1444941327
➜  tensorflow git:(master) ✗ bazel build -c opt //tensorflow/tools/pip_package:build_pip_package
ERROR: Loading of target '//tools/jdk:jdk' failed; build aborted: no such package 'tools/jdk': BUILD file not found on package path.
ERROR: Loading failed; build aborted.

Also, I don't understand why the instructions (on bazel site) recommends installing JDK8 while bazel 0.1.1 was built against JDK7?

FabHan avatar Nov 13 '15 00:11 FabHan

JDK 7 is a legacy version and might still have some issue. Prefer to use the 0.1.1 (without -jdk8) if you can.

Can you cat ~/.bazelrc ? What's your installation directory?

damienmg avatar Nov 13 '15 09:11 damienmg

OK, I had installed the wrong build. I have reinstalled 0.1.1 (without -jdk7) and now run into the old problem.

➜  tensorflow git:(master) ✗ bazel version
Build label: 0.1.1
Build target: bazel-out/local_linux-fastbuild/bin/src/main/java/bazel-main_deploy.jar
Build time: Thu Oct 15 20:15:14 2015 (1444940114)
Build timestamp: 1444940114
Build timestamp as int: 1444940114
➜  tensorflow git:(master) ✗ bazel build -c opt //tensorflow/tools/pip_package:build_pip_package
INFO: Elapsed time: 1.880s
java.lang.NoClassDefFoundError: com/jcraft/jsch/JSchException
        at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:109)
        at org.eclipse.jgit.transport.SshTransport.getSession(SshTransport.java:136)
        at org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.<init>(TransportGitSsh.java:262)
        at org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:161)
        at org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:136)
        at org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:122)
        at org.eclipse.jgit.transport.Transport.fetch(Transport.java:1138)
        at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:130)
        at org.eclipse.jgit.api.CloneCommand.fetch(CloneCommand.java:193)
        at org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:133)
        at com.google.devtools.build.lib.bazel.repository.GitCloneFunction.compute(GitCloneFunction.java:124)
        at com.google.devtools.build.skyframe.ParallelEvaluator$Evaluate.run(ParallelEvaluator.java:810)
        at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$2.run(AbstractQueueVisitor.java:439)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: com.jcraft.jsch.JSchException
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

~/.bazelrc doesn't exist on my system.

FabHan avatar Nov 13 '15 16:11 FabHan

Sorry. I just commented on the old issue without realising that this one was open. I'm hitting the same issue, reproduced also on Ubuntu Trusty (14.04) with 0.1.1 JDK 7 using released bazel install script.

pwaller avatar Nov 15 '15 19:11 pwaller

Sorry I missed the bug. Invoking @davidzchen for his expertise on the first issue.

damienmg avatar Nov 17 '15 11:11 damienmg

This issue is fixed by 916370ec6195d7fc13812e64a65c2cd6ef9e36c9. Sorry, I had thought that this commit was in the 0.1.1 release, but it looks like it is, in fact, not in the release.

I was able to build by checking out and building Bazel at commit 916370ec6195d7fc13812e64a65c2cd6ef9e36c9 then building TensorFlow. Can you give that a try to see if it works for you?

@damienmg What is our timeline for cutting the next release?

davidzchen avatar Nov 17 '15 13:11 davidzchen

I want to cut the next release candidate in the next 2 days but I want to see it validated inside Google first.

On Tue, Nov 17, 2015 at 2:19 PM David Z. Chen [email protected] wrote:

This issue is fixed by 916370e https://github.com/bazelbuild/bazel/commit/916370ec6195d7fc13812e64a65c2cd6ef9e36c9. Sorry, I had thought that this commit was in the 0.1.1 release, but it looks like it is, in fact, not in the release https://github.com/bazelbuild/bazel/commits/0.1.1.

I was able to build by checking out and building Bazel at commit 916370e https://github.com/bazelbuild/bazel/commit/916370ec6195d7fc13812e64a65c2cd6ef9e36c9 then building TensorFlow. Can you give that a try to see if it works for you?

@damienmg https://github.com/damienmg What is our timeline for cutting the next release?

— Reply to this email directly or view it on GitHub https://github.com/bazelbuild/bazel/issues/596#issuecomment-157368747.

damienmg avatar Nov 17 '15 13:11 damienmg

Well, I guess I'd rather wait for the next release. Too many attempts at this already.

It surprises me though that either just a few people have tried to build from source or they don't run into this problem.

FabHan avatar Nov 17 '15 16:11 FabHan

Hi, I also tried to build from source and it fails. I used Bazel commit 916370e, but was still running into the issue of accessing remote repository through proxy. So I manually downloaded the packages and used 'local_repository' directive in WORKSPACE to point to the local path for packages: libpng, jpegsrc, re2, and gemmlowp After this, the proxy issue went away, but the build still fails.. now due to a cycle in dependency graph, as follows:

$ 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.

Any help/suggestion would be great!

Thanks,

RoyS

srsaharoy avatar Nov 17 '15 23:11 srsaharoy

Can you try:

bazel clean --expunge
bazel build -c opt //tensorflow/cc:tutorials_example_trainer

If it doesn't work, can you open a separate issue?

damienmg avatar Nov 18 '15 15:11 damienmg

No, it did not help... same error 'cycle in dependency graph'

I also commented about this issue at: https://github.com/bazelbuild/bazel/issues/587 (tensorflow building issue on ubuntu 14.04: Accessing remote repository through a proxy #587 )

srsaharoy avatar Nov 18 '15 19:11 srsaharoy

Can you open a new issue with a link of the workspace file you are using (also copy a link to this bug)?

damienmg avatar Nov 18 '15 19:11 damienmg

just opened a new issue https://github.com/bazelbuild/bazel/issues/623 , with the workspace and build files

Thanks

srsaharoy avatar Nov 18 '15 20:11 srsaharoy

Relabeled this bug as the remaining problem is resolved but needs to wait for next release.

damienmg avatar Nov 19 '15 10:11 damienmg

Everything on track I should cut the new release candidate tomorrow.

damienmg avatar Nov 19 '15 18:11 damienmg

Release is out :)

damienmg avatar Dec 11 '15 14:12 damienmg