'//tensorflow:workspace.bzl': file doesn't exist or isn't a file.

1,216 views
Skip to first unread message

Alexander Sommer

unread,
Sep 24, 2016, 3:31:18 PM9/24/16
to bazel-discuss
Hi, 
 
I tried to install tensorflow with android, according to the official install manual, but i am coping with an error that bazel cannot find the workspace.bzl file


alex@alex-VirtualBox:~/tensorflow$ bazel build //tensorflow/examples/android:tensorflow_demo --verbose_failures
ERROR: com.google.devtools.build.lib.packages.BuildFileContainsErrorsException: error loading package '': Extension file not found. Unable to load file '//tensorflow:workspace.bzl': file doesn't exist or isn't a file.
INFO: Elapsed time: 0.078s
alex@alex-VirtualBox:~/tensorflow$


I would be very thankful for any hint.. 


thx

alex



Damien Martin-guillerez

unread,
Sep 24, 2016, 3:43:40 PM9/24/16
to Alexander Sommer, bazel-discuss

Did you ran ./configure beforehand?


--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/7c0919cf-204d-477a-b9f1-a115e9e30fa6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alexander Sommer

unread,
Sep 25, 2016, 3:17:09 AM9/25/16
to Damien Martin-guillerez, bazel-discuss
No, how do i do that? Seems i missed a step in the tutorial. Where is the description for that?

Von meinem iPhone gesendet

Alexander Sommer

unread,
Sep 25, 2016, 4:16:45 AM9/25/16
to bazel-discuss, alexande...@gmail.com
at least in bazel i could not find configure.. 

Thiago Farina

unread,
Sep 25, 2016, 6:01:32 AM9/25/16
to Alexander Sommer, bazel-discuss


On Sunday, September 25, 2016, Alexander Sommer <alexande...@gmail.com> wrote:
at least in bazel i could not find configure.. 

No, you don't run like this. It is not a command of Bazel tool, like build, run or test.

'configure' is a shell script you run alone (it is part of autotools). 

So instead of 'bazel ./configure' you run it in your command line shell like this:

$ ./configure

Are you trying to build tensorflow from source following the instructions from https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_started/os_setup.md?


--
Thiago Farina

Alexander Sommer

unread,
Sep 25, 2016, 10:00:24 AM9/25/16
to Thiago Farina, bazel-discuss
Hi, 

I just re-checked out tensorflow, now the workspace.bzl file is here, but i am struggling with another error message: 

Inline-Bild 1Inline-Bild 2

Damien Martin-guillerez

unread,
Sep 26, 2016, 2:29:04 PM9/26/16
to Alexander Sommer, Thiago Farina, bazel-discuss
Do you have a proxy to access internet?

--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.

Alexander Sommer

unread,
Sep 27, 2016, 1:28:34 PM9/27/16
to Damien Martin-guillerez, Thiago Farina, bazel-discuss
no, i am a huge step further now, i can bazel start to run, but the process stops with: 

ERROR: /home/alex/tensorflow/tensorflow/examples/android/BUILD:54:1: Processing Android resources for //tensorflow/examples/android:tensorflow_demo failed: linux-sandbox failed: error executing command /home/alex/.cache/bazel/_bazel_alex/e5e91d04dba258d6e6aaded8e10da03e/execroot/tensorflow/_bin/linux-sandbox ... (remaining 28 argument(s) skipped).
Error: bazel-out/host/bin/external/androidsdk/aapt_binary: line 4: /home/alex/.cache/bazel/_bazel_alex/e5e91d04dba258d6e6aaded8e10da03e/execroot/tensorflow/bazel-out/host/bin/external/androidsdk/aapt_binary.runfiles/androidsdk/build-tools/23.0.1/aapt: No such file or directory
Sep 26, 2016 11:16:52 PM com.google.devtools.build.android.AndroidResourceProcessingAction main
SEVERE: Error during merging resources
Error: Failed to run command:
bazel-out/host/bin/external/androidsdk/aapt_binary s -i /tmp/android_resources_tmp6099972390647729498/tmp-deduplicated/tensorflow/examples/android/res/drawable-mdpi/ic_launcher.png -o /tmp/android_resources_tmp6099972390647729498/merged_resources/drawable-mdpi-v4/ic_launcher.png
Error Code:
1
Output:
bazel-out/host/bin/external/androidsdk/aapt_binary: line 4: /home/alex/.cache/bazel/_bazel_alex/e5e91d04dba258d6e6aaded8e10da03e/execroot/tensorflow/bazel-out/host/bin/external/androidsdk/aapt_binary.runfiles/androidsdk/build-tools/23.0.1/aapt: No such file or directory

at com.android.ide.common.res2.MergeWriter.end(MergeWriter.java:54)
at com.android.ide.common.res2.MergedResourceWriter.end(MergedResourceWriter.java:113)
at com.android.ide.common.res2.DataMerger.mergeData(DataMerger.java:291)
at com.android.ide.common.res2.ResourceMerger.mergeData(ResourceMerger.java:48)
at com.google.devtools.build.android.AndroidResourceProcessor.mergeData(AndroidResourceProcessor.java:932)
at com.google.devtools.build.android.AndroidResourceProcessingAction.main(AndroidResourceProcessingAction.java:257)
Caused by: com.android.ide.common.internal.LoggedErrorException: Failed to run command:
bazel-out/host/bin/external/androidsdk/aapt_binary s -i /tmp/android_resources_tmp6099972390647729498/tmp-deduplicated/tensorflow/examples/android/res/drawable-mdpi/ic_launcher.png -o /tmp/android_resources_tmp6099972390647729498/merged_resources/drawable-mdpi-v4/ic_launcher.png
Error Code:
1
Output:
bazel-out/host/bin/external/androidsdk/aapt_binary: line 4: /home/alex/.cache/bazel/_bazel_alex/e5e91d04dba258d6e6aaded8e10da03e/execroot/tensorflow/bazel-out/host/bin/external/androidsdk/aapt_binary.runfiles/androidsdk/build-tools/23.0.1/aapt: No such file or directory

at com.android.ide.common.internal.CommandLineRunner.runCmdLine(CommandLineRunner.java:123)
at com.android.ide.common.internal.CommandLineRunner.runCmdLine(CommandLineRunner.java:96)
at com.android.ide.common.internal.AaptCruncher.crunchPng(AaptCruncher.java:58)
at com.android.ide.common.res2.MergedResourceWriter$1.call(MergedResourceWriter.java:188)
at com.android.ide.common.res2.MergedResourceWriter$1.call(MergedResourceWriter.java:139)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
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)

Exception in thread "main" Error: Failed to run command:
bazel-out/host/bin/external/androidsdk/aapt_binary s -i /tmp/android_resources_tmp6099972390647729498/tmp-deduplicated/tensorflow/examples/android/res/drawable-mdpi/ic_launcher.png -o /tmp/android_resources_tmp6099972390647729498/merged_resources/drawable-mdpi-v4/ic_launcher.png
Error Code:
1
Output:
bazel-out/host/bin/external/androidsdk/aapt_binary: line 4: /home/alex/.cache/bazel/_bazel_alex/e5e91d04dba258d6e6aaded8e10da03e/execroot/tensorflow/bazel-out/host/bin/external/androidsdk/aapt_binary.runfiles/androidsdk/build-tools/23.0.1/aapt: No such file or directory

at com.android.ide.common.res2.MergeWriter.end(MergeWriter.java:54)
at com.android.ide.common.res2.MergedResourceWriter.end(MergedResourceWriter.java:113)
at com.android.ide.common.res2.DataMerger.mergeData(DataMerger.java:291)
at com.android.ide.common.res2.ResourceMerger.mergeData(ResourceMerger.java:48)
at com.google.devtools.build.android.AndroidResourceProcessor.mergeData(AndroidResourceProcessor.java:932)
at com.google.devtools.build.android.AndroidResourceProcessingAction.main(AndroidResourceProcessingAction.java:257)
Caused by: com.android.ide.common.internal.LoggedErrorException: Failed to run command:
bazel-out/host/bin/external/androidsdk/aapt_binary s -i /tmp/android_resources_tmp6099972390647729498/tmp-deduplicated/tensorflow/examples/android/res/drawable-mdpi/ic_launcher.png -o /tmp/android_resources_tmp6099972390647729498/merged_resources/drawable-mdpi-v4/ic_launcher.png
Error Code:
1
Output:
bazel-out/host/bin/external/androidsdk/aapt_binary: line 4: /home/alex/.cache/bazel/_bazel_alex/e5e91d04dba258d6e6aaded8e10da03e/execroot/tensorflow/bazel-out/host/bin/external/androidsdk/aapt_binary.runfiles/androidsdk/build-tools/23.0.1/aapt: No such file or directory

at com.android.ide.common.internal.CommandLineRunner.runCmdLine(CommandLineRunner.java:123)
at com.android.ide.common.internal.CommandLineRunner.runCmdLine(CommandLineRunner.java:96)
at com.android.ide.common.internal.AaptCruncher.crunchPng(AaptCruncher.java:58)
at com.android.ide.common.res2.MergedResourceWriter$1.call(MergedResourceWriter.java:188)
at com.android.ide.common.res2.MergedResourceWriter$1.call(MergedResourceWriter.java:139)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
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)
Target //tensorflow/examples/android:tensorflow_demo failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 52.213s, Critical Path: 12.56s


2016-09-26 20:28 GMT+02:00 Damien Martin-guillerez <dmar...@google.com>:
Do you have a proxy to access internet?

On Sun, Sep 25, 2016 at 10:00 AM Alexander Sommer <alexande...@gmail.com> wrote:
Hi, 

I just re-checked out tensorflow, now the workspace.bzl file is here, but i am struggling with another error message: 

Inline-Bild 1Inline-Bild 2

2016-09-25 12:01 GMT+02:00 Thiago Farina <tfa...@chromium.org>:


On Sunday, September 25, 2016, Alexander Sommer <alexande...@gmail.com> wrote:
at least in bazel i could not find configure.. 

No, you don't run like this. It is not a command of Bazel tool, like build, run or test.

'configure' is a shell script you run alone (it is part of autotools). 

So instead of 'bazel ./configure' you run it in your command line shell like this:

$ ./configure

Are you trying to build tensorflow from source following the instructions from https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_started/os_setup.md?


--
Thiago Farina


--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discuss+unsubscribe@googlegroups.com.

Damien Martin-guillerez

unread,
Sep 27, 2016, 1:29:55 PM9/27/16
to Alexander Sommer, ahum...@google.com, Thiago Farina, bazel-discuss
+Alex Humesky for the android part, might be able to help or pull in more people :)

To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.

Alex Humesky

unread,
Sep 27, 2016, 1:53:32 PM9/27/16
to Damien Martin-guillerez, Alexander Sommer, Thiago Farina, bazel-discuss
Do you have build tools version 23.0.1 installed in your android sdk?
You can check with
$ ls <android-sdk>/build-tools
and seeing what versions are available there.
You can install / update new sdk build tools by running the sdk manager with <android-sdk>/tools/android
then update the build_tools_version attribute of the android_sdk_repository rule in your WORKSPACE file

Alexander Sommer

unread,
Sep 27, 2016, 2:04:41 PM9/27/16
to Alex Humesky, Damien Martin-guillerez, Thiago Farina, bazel-discuss
i just looked in my folder, and yes, i have 23.0.1

Inline-Bild 1

To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discuss+unsubscribe@googlegroups.com.

Alex Humesky

unread,
Sep 27, 2016, 2:17:50 PM9/27/16
to Alexander Sommer, Damien Martin-guillerez, Thiago Farina, bazel-discuss
As a sanity check, can you check that aapt is in the 23.0.1 directory?
can you try without the sandbox? --spawn_strategy=standalone

To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.

Alexander Sommer

unread,
Sep 27, 2016, 4:50:05 PM9/27/16
to Alex Humesky, Damien Martin-guillerez, Thiago Farina, bazel-discuss
finally, the magic was this: 

sudo apt-get install libc6:i386
sudo apt-get install zlib1g-dev:i386




To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discuss+unsubscribe@googlegroups.com.

Alex Humesky

unread,
Sep 27, 2016, 4:53:51 PM9/27/16
to Alexander Sommer, Damien Martin-guillerez, Thiago Farina, bazel-discuss
aha, right, that's a very misleading message when a binary can't find its libraries.

To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.

Alexander Sommer

unread,
Sep 27, 2016, 4:55:55 PM9/27/16
to Alex Humesky, Damien Martin-guillerez, Thiago Farina, bazel-discuss
nevertheless, thank you much for your support!

To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discuss+unsubscribe@googlegroups.com.

Laurent Le Brun

unread,
Oct 5, 2016, 3:41:10 AM10/5/16
to Alexander Sommer, bazel-...@googlegroups.com, Damien Martin-guillerez, Alex Humesky, Thiago Farina

Can someone make sure the instructions are updated, to improve experience of other users?


Alexander Sommer

unread,
Oct 7, 2016, 2:29:11 PM10/7/16
to Laurent Le Brun, bazel-discuss, Damien Martin-guillerez, Alex Humesky, Thiago Farina
hi, 

here is the full doc (at least, what we did to run it)

1- Install oracle-java according to the answer provided in this link:

2- Open a terminal and enter this line (it will install pip3 for python3):
$ sudo apt-get install python3-pip

3- For the CPU only version of tensorflow, enter these lines in the terminal:
$ sudo pip3 install --upgrade $TF_BINARY_URL


4- Test so if the tensorflow is installed, enter these lines in a terminal:
$ python3

>>> import tensorflow as tf

If you see no error, you are good to go. Open a new terminal or type exit() and hit enter.

5- Install bazel ( if it asks for [y,n], choose y and hit enter):

$ sudo apt-get install software-properties-common

$ $ echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list


$ sudo apt-get update && sudo apt-get install bazel

$ sudo apt-get upgrade bazel

6 - Download android studio, and then extract it to Downloads folder (You can extract it anywhere you like, but remember the path).

8 - Enter these two lines in a terminal:
$ sudo apt-get install libc6:i386

$ sudo apt-get install zlib1g-dev:i386

9 - Open android studio:
- cd to the folder android-studio/bin and then type ./studio.sh in the terminal and hit enter.

10 - Download ndk version r11c with this link and extract it into Downloads folder (You can extract it anywhere you like, but remember the path):

11 - Install git, so you could clone tensorflow git repository:
$ sudo apt install git

13 - Clone the git repository of tensorflow with this line in the terminal:


14 - cd into tensorflow folder, Open a terminal and type:
$ cd tensorflow

And enter these lines in the same terminal where you are in the tensorflow directory (so you will add the assets directory to android example):
$ unzip /tmp/inception5h.zip -d tensorflow/examples/android/assets/

15 - Open the WORKSPACE file in the tensorflow root folder.
- Change and uncomment the lines for the path of NDK and SDK.
- Mine was like this:
android_ndk_repository(
        name="androidndk",
        path="/home/shahryar/Downloads/android-ndk-r11c",
        api_level=21)

android_sdk_repository(
        name = "androidsdk",
        api_level = 24,
        build_tools_version = "24.0.3",
        # Replace with path to Android SDK on your system
        path = "/home/shahryar/Android/Sdk",
        )

16 - Now in the same terminal (where you have cd to tensorflow), type this in the terminal:
$ ./configure
and then type the default path for python3 like this:
$ /usr/bin/python3
and choose N (NO) ([y/N]) whenever it asks for it (maybe 2 times).

17 - Now cd to Workspace root folder and enter this in terminal:
$ bazel build //tensorflow/examples/android:tensorflow_demo

18 - And you can find the .apk files in the tensorflow/bazel-bin/tensorflow/examples/android



Reply all
Reply to author
Forward
0 new messages