Error while building TensorFlow from source - tensorflow

I am trying to build TensorFlow cpu only r1.11 from source on a Debian OS following this tutorial: https://www.tensorflow.org/install/source
I installed bazel as indicated using this tutorial https://docs.bazel.build/versions/master/install-ubuntu.html from the binary installer as recommended.
Then I followed each step and everything worked fine until this command:
bazel test -c opt -- //tensorflow/... -//tensorflow/compiler/... -//tensorflow/contrib/lite/...
It shows me this error:
ERROR: error loading package '': Encountered error while reading extension file 'closure/defs.bzl': no such package '#io_bazel_rules_closure//closure': The native http_archive rule is deprecated. load("#bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") for a drop-in replacement.
Use --incompatible_remove_native_http_archive=false to temporarily continue using the native rule.
ERROR: error loading package '': Encountered error while reading extension file 'closure/defs.bzl': no such package '#io_bazel_rules_closure//closure': The native http_archive rule is deprecated. load("#bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") for a drop-in replacement.
Use --incompatible_remove_native_http_archive=false to temporarily continue using the native rule.
INFO: Elapsed time: 0.088s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
FAILED: Build did NOT complete successfully (0 packages loaded)
I read online that this is likely related to bazel. So I tried reinstalling bazel using the Using Bazel custom APT repository but I got the same error.

As of version 1.12.0, TensorFlow uses some deprecated Bazel features that are being completely dropped in recent versions of Bazel. Instead of using the most recent version, try using an older one for now. I was able to build TensorFlow 1.12.0 on Windows using Bazel 0.18.1, most likely that should work with TensorFlow 1.11 too.

I agree with #jdehesa. Even I was struggling to build the tensorflow using from scratch. I tried different versions, 0.26,0.21,0.19.1 and finally it worked with 0.18.1. So, it is a bazel issue rather than Tensorflow. TF_version=1.12.0

Related

problem building TensorFlow r1.13 from sources

I'm trying to build under Ubuntu 18.04 TensorFlow r1.13 from sources and whichever compatible version of bazel I use I get the same errors:
ERROR: /home/hamlatzis/.cache/bazel/_bazel_hamlatzis/bc20d0623a1a0c4eaa510688c26216cb/external/io_bazel_rules_closure/closure/protobuf/closure_proto_library.bzl:66:21: name 'ProtoInfo' is not defined (did you mean 'protos'?)
ERROR: error loading package '': Extension 'closure/protobuf/closure_proto_library.bzl' has errors
ERROR: error loading package '': Extension 'closure/protobuf/closure_proto_library.bzl' has errors
I need to be on r1.13, but to be on the safe side I've tried with other branches (r1.14 and master) and had no problems with those
Any idea?
Try a different Bazel version.
Bazel 0.21.0 worked for me for Tensorflow r1.13.

build tensorflow from source error: Encountered error while reading extension file 'closure/defs.bzl': no such package

I need to build tensorflow from source.
After git clone and run the following check command:
bazel test -c opt -- //tensorflow/... -//tensorflow/compiler/... -//tensorflow/contrib/lite/...
And I get the following error:
bazel test -c opt -- //tensorflow/... -//tensorflow/compiler/... -//tensorflow/contrib/lite/...
WARNING: The following rc files are no longer being read, please transfer their contents or import their path into one of the standard rc files:
/home/rich/research/installations/tensorflow/tensorflow/tools/bazel.rc
INFO: Invocation ID: 1a1c9f70-531e-49a0-b8e7-9f4d7ab4b24b
ERROR: error loading package '': Encountered error while reading extension file 'closure/defs.bzl': no such package '#io_bazel_rules_closure//closure': The native http_archive rule is deprecated. load("#bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") for a drop-in replacement.
Use --incompatible_remove_native_http_archive=false to temporarily continue using the native rule.
ERROR: error loading package '': Encountered error while reading extension file 'closure/defs.bzl': no such package '#io_bazel_rules_closure//closure': The native http_archive rule is deprecated. load("#bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") for a drop-in replacement.
Use --incompatible_remove_native_http_archive=false to temporarily continue using the native rule.
INFO: Elapsed time: 0.046s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
FAILED: Build did NOT complete successfully (0 packages loaded)
Sounds like you are using a bazel version that is too new.
The latest released bazel version according to https://blog.bazel.build/ is 0.22, but the latest bazel version mentioned in the "Tested build configurations" section of https://www.tensorflow.org/install/source is 0.15.0 (used for tensorflow 1.12)

how to compile summarize_graph with bazel in Tensorflow

I am testing a Movidius Neural Compute stick.
My first test is to replicate this guide with Inception_v4 model:
https://movidius.github.io/ncsdk/tf_modelzoo.html
I do need to know the "output_node_name" for the freeze_graph.py.
I have found instructions to do so in tensorflow docs:
bazel build tensorflow/tools/graph_transforms:summarize_graph
bazel-bin/tensorflow/tools/graph_transforms/summarize_graph --in_graph=MY_PB_FILE.pb
However, when trying to follow steps, I get the following error:
lberto#alberto-OptiPlex-9010:~/movidius_ws$ bazel build tensorflow/tools/graph_transforms:summarize_graph
Starting local Bazel server and connecting to it...
ERROR: Skipping 'tensorflow/tools/graph_transforms:summarize_graph': no such package 'tensorflow/tools/graph_transforms': BUILD file not found on package path
WARNING: Target pattern parsing failed.
ERROR: no such package 'tensorflow/tools/graph_transforms': BUILD file not found on package path
INFO: Elapsed time: 0.947s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
According to the guide provided by Movidius, it is not necessary to install tensorflow in the host, only download the source code. I have cloned the Tensorflow source code in a directory to follow the guide, and the movidius tools in a docker container sharing that directory.
What am I doing wrong building the summarize_graph application?
I need to have this application running to know the output_node_names that I want to use with the movidius neural compute stick
Thank you.
Make sure the following files exist:
"~/movidius_ws/WORKSPACE"
"~/movidius_ws/tensorflow/tools/graph_transforms/BUILD" or "~/movidius_ws/tensorflow/tools/graph_transforms/BUILD.bazel"
If they do, check the list of targets in the "//tensorflow/tools/graph_transforms" package:
bazel query //tensorflow/tools/graph_transforms:*
and see if "summarize_graph" is there.

Geting ERROR: Config value cuda is not defined in any .rc file when trying to train mobilenet in tensorflow

I'm trying to run MobileNet_v1 on ImageNet and for that I'm using the official Tensorflow Model repository and following their guide.
However when I actually tried to run the training for MobileNet_v1 by first initiating :
models/research/slim$ bazel build -c opt --config=cuda mobilenet_v1_{eval,train}
I got :
Starting local Bazel server and connecting to it...
INFO: Options provided by the client:
Inherited 'common' options: --isatty=1 --terminal_columns=146
ERROR: Config value cuda is not defined in any .rc file
All previous steps have been successful and everything seems fine except this one.
I'm using :
Ubuntu 16.04
TF version: v1.7.0 (and 1.10.1)
Cuda v9.0
cuDNN v7.0 (and 7.1.3)
bazel release 0.16.1
According to the bazel releases page,
--[no]allow_undefined_configs no longer exists, passing undefined
configs is an error.
as of version 0.16.0 and above.
Using an older version of bazel should solve your problem for now.

Tensor flow installation from source issue in Build your target with GPU support

This first time for me to install Tensorflow. I followed the instructions on official website here. I installed from source because I found some people advice to do that instead of pip installation. I used version r0.9 of tensorflow and I installed it on Ubuntu-mate 15.10. I followed all instructions. Installed python, cuda version 7.5, cudnn release 5. Nvidia GPU 5200 with compute capability of 2.1. Every thing went well until I reached bazel build step here,
Latitude-E6430:~/tensorflow$ bazel build -c opt --config=cuda //tensorflow/cc:tutorials_example_trainer
"Latetude-E6430" is the user of the machine.
I got the following errors immediately:
ERROR: /home/meqdad/tensorflow/tensorflow/core/BUILD:91:1: //tensorflow/core:protos_all_py: no such attribute 'imports' in 'py_library' rule.
ERROR: /home/meqdad/tensorflow/tensorflow/cc/BUILD:28:1: Target '//tensorflow/core:sparse_ops_op_lib' contains an error and its package is in error and referenced by '//tensorflow/cc:ops/sparse_ops_gen_cc'.
ERROR: Loading failed; build aborted.
I tried to find a solution to this problem, I was using bazel 0.1 then I upgraded to bazel 0.3. However, on the net, there is several issues like this one but non of them was related to this one. I re-installed py_library but it did nothing to solve the problem.
Please can you advice me how to move on with this step of installation.