Building TensorFlow 2 with bazel 0.29.1 on Windows 10 fails - tensorflow

Trying to compile TF 2.0 with Bazel, ends up in a failure.
I am struggling this issue for quite a while, looked it up online, but haven't found any solution to the exact problem. Several running configuration (with or w/o Cuda, with or w/o creating zip file, etc) eventually leading to the same failure.
System information:
OS Platform and Distribution (Windows 10)
TensorFlow installed from (source)
TensorFlow version: 2.0 (master branch on 07 Nov 2019, to be exact)
Python version: 3.7
Installed using virtualenv? pip? conda?: No
Bazel version (if compiling from source): 0.29.1
GCC/Compiler version (if compiling from source): 8.1.0
CUDA/cuDNN version: 10.0/7
GPU model and memory: GeForce GTX 1050 15.88 GB RAM
My actions:
1. git checkout master (in the TF git repo)
2. bazel clean
3. configure (all defaults except for python path and Cuda)
4. bazel build --config=cuda --define=no_tensorflow_py_deps=true tensorflow:tensorflow_cc.dll
Failure message:
ERROR: C:/users/shahar/git/tensorflow/tensorflow/core/BUILD:2537:1:
Executing genrule //tensorflow/core:version_info_gen failed (Exit 5)
LAUNCHER ERROR: Cannot launch process: "C:/Program
Files/WindowsApps/PythonSoftwareFoundation.Python.3.7_3.7.1520.0_x64__qbz5n2kfra8p0/python.exe"
C:\users\shahar_bazel_shahar\duchsbgv\execroot\org_tensorflow\bazel-out\x64_windows-opt\bin\tensorflow\tools\git\gen_git_source.zip
--generate external/local_config_git/gen/spec.json external/local_config_git/gen/head
external/local_config_git/gen/branch_ref
bazel-out/x64_windows-opt/bin/tensorflow/core/util/version_info.cc
--git_tag_override= Reason: (error: 5): Access is denied.
What am i doing wrong?
Edit:
added a junction with #László advice:
mklink /j c:\python "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.1520.0_x64__qbz5n2kfra8p0"
and used it when "configure" asked me to, for both python.exe and the libs, yet the error remains. details:
ERROR: C:/users/shahar/git/tensorflow/tensorflow/core/BUILD:2537:1:
Executing genrule //tensorflow/core:version_info_gen failed (Exit 5)
LAUNCHER ERROR: Cannot launch process: "C:/python/python.exe"
C:\users\shahar_bazel_shahar\duchsbgv\execroot\org_tensorflow\bazel-out\x64_windows-opt\bin\tensorflow\tools\git\gen_git_source.zip
--generate external/local_config_git/gen/spec.json external/local_config_git/gen/head
external/local_config_git/gen/branch_ref
bazel-out/x64_windows-opt/bin/tensorflow/core/util/version_info.cc
--git_tag_override= Reason: (error: 5): Access is denied.
Edit_2:
Again with #László help:
I ran:
bazel info execution_root
got a path, cd into it.
From there i ran:
c:\python\python.exe c:\users\shahar\_bazel_shahar\duchsbgv\execroot\org_tensorflow\bazel-out\x64_windows-opt\bin\tensorflow\tools\git\gen_git_source.zip --generate external/local_config_git/gen/spec.json external/local_config_git/gen/head external/local_config_git/gen/branch_ref c:\tmp\foo.cc --git_tag_override=
and got the following error message:
Traceback (most recent call last): File
"\?\C:\Users\Shahar\AppData\Local\Temp\Bazel.runfiles_ltu2ig_a\runfiles\org_tensorflow\tensorflow\tools\git\gen_git_source.py",
line 340, in
generate(args.generate, args.git_tag_override) File "\?\C:\Users\Shahar\AppData\Local\Temp\Bazel.runfiles_ltu2ig_a\runfiles\org_tensorflow\tensorflow\tools\git\gen_git_source.py",
line 273, in generate
write_version_info(dest_file, git_version) File "\?\C:\Users\Shahar\AppData\Local\Temp\Bazel.runfiles_ltu2ig_a\runfiles\org_tensorflow\tensorflow\tools\git\gen_git_source.py",
line 228, in write_version_info
open(filename, "w").write(contents) FileNotFoundError: [Errno 2] No such file or directory: 'c:\tmp\foo.cc'

I suspect the space in the Python path.
Try this:
open cmd.exe
create a junction c:\python pointing to the real Python directory:
mklink /j c:\python "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.1520.0_x64__qbz5n2kfra8p0"
You can use any other path than c:\python, just make sure there's no space or special characters in it.
run ./configure.py again, use c:\python

Related

Error installing MoveIt 2 from source on Ubuntu 20.04 VM

I'm trying to get involved in open source and also am quite interested in robotics, so I thought about contributing to MoveIt 2. As a first step, I'm installing MoveIt 2 from source on my Ubuntu 20.04 VM in VirtualBox.
I've run through all the instructions here: https://moveit.ros.org/install-moveit2/source/#:~:text=colcon%20build%20%2D%2Devent%2Dhandlers%20desktop_notification%2D%20status%2D%20%2D%2Dcmake%2Dargs%20%2DDCMAKE_BUILD_TYPE%3DRelease
However, the build is failing on the highlighted part. The error message is as follows:
Starting >>> geometric_shapes
--- stderr: geometric_shapes
CMake Error at CMakeLists.txt:47 (find_package):
By not providing "Findeigen3_cmake_module.cmake" in CMAKE_MODULE_PATH this
project has asked CMake to find a package configuration file provided by
"eigen3_cmake_module", but CMake did not find one.
Could not find a package configuration file provided by
"eigen3_cmake_module" with any of the following names:
eigen3_cmake_moduleConfig.cmake
eigen3_cmake_module-config.cmake
Add the installation prefix of "eigen3_cmake_module" to CMAKE_PREFIX_PATH
or set "eigen3_cmake_module_DIR" to a directory containing one of the above
files. If "eigen3_cmake_module" provides a separate development package or
SDK, be sure it has been installed.
---
Failed <<< geometric_shapes [1.20s, exited with code 1]
Summary: 0 packages finished [1.46s]
1 package failed: geometric_shapes
1 package had stderr output: geometric_shapes
33 packages not processed
Any help is really appreciated. Thanks!
You have to install ROS2 before building Move It 2. After installing the ROS2 binaries, the error doesn't occur.

Unable to build bazel project: no such package '#io_bazel_rules_kotlin//kotlin'

OS:
daz#daz:/rom/aosp-mirror/android-test$ uname -ar
Linux daz 5.4.0-28-generic #32-Ubuntu SMP Wed Apr 22 17:40:10 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Building with bazel-2.2.0 with the target in the code below:
daz#daz:/rom/aosp-mirror/android-test$ bazel-2.2.0 build :axt_m2repository
I am trying to build the android-test repo here:
https://github.com/android/android-test
The definition for these rules appears to be this:
# Kotlin toolchains
rules_kotlin_version = "4c71740a1b63b785fc90afd8d4d4d5bfda527107"
http_archive(
name = "io_bazel_rules_kotlin",
sha256 = "c0ca7b66d9f466067635482592634703bf0a648d51ec958f41796d43ca8256b3",
strip_prefix = "rules_kotlin-%s" % rules_kotlin_version,
type = "zip",
urls = ["https://github.com/bazelbuild/rules_kotlin/archive/%s.zip" % rules_kotlin_version],
)
load("#io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kotlin_repositories", "kt_register_toolchains")
kotlin_repositories()
kt_register_toolchains()
But I get the following exception when trying to build:
ERROR: error loading package '': Encountered error while reading extension file 'kotlin/kotlin.bzl': no such package '#io_bazel_rules_kotlin//kotlin': error loading package 'external': Could not load //external package
The full output is here:
ERROR: /home/daz/.cache/bazel/_bazel_daz/ff62db25b941d7730a4c94ee1d6f2c41/external/robolectric/bazel/robolectric.bzl:2:5: Traceback (most recent call last):
File "/rom/aosp-mirror/android-test/WORKSPACE", line 130
robolectric_repositories()
File "/home/daz/.cache/bazel/_bazel_daz/ff62db25b941d7730a4c94ee1d6f2c41/external/robolectric/bazel/robolectric.bzl", line 381, in robolectric_repositories
android_all_jars()
File "/home/daz/.cache/bazel/_bazel_daz/ff62db25b941d7730a4c94ee1d6f2c41/external/robolectric/bazel/robolectric.bzl", line 2, in android_all_jars
native.maven_jar
no native function or rule 'maven_jar'
Available attributes: aar_import, action_listener, alias, android_binary, android_device, android_device_script_fixture, android_host_service_fixture, android_instrumentation_test, android_library, android_local_test, android_ndk_repository, android_sdk, android_sdk_repository, android_tools_defaults_jar, apple_binary, apple_cc_toolchain, apple_static_library, available_xcodes, bazel_version, bind, cc_binary, cc_host_toolchain_alias, cc_import, cc_libc_top_alias, cc_library, cc_proto_library, cc_test, cc_toolchain, cc_toolchain_alias, cc_toolchain_suite, config_feature_flag, config_setting, constraint_setting, constraint_value, environment, existing_rule, existing_rules, exports_files, extra_action, fdo_prefetch_hints, fdo_profile, filegroup, genquery, genrule, glob, j2objc_library, java_binary, java_import, java_library, java_lite_proto_library, java_package_configuration, java_plugin, java_proto_library, java_runtime, java_runtime_alias, java_test, java_toolchain, java_toolchain_alias, label_flag, label_setting, local_config_platform, local_repository, new_local_repository, ninja_build, ninja_graph, objc_import, objc_library, package_group, package_name, platform, proto_lang_toolchain, proto_library, py_binary, py_library, py_runtime, py_test, register_execution_platforms, register_toolchains, repository_name, sh_binary, sh_library, sh_test, test_suite, toolchain, toolchain_type, xcode_config, xcode_config_alias, xcode_version
ERROR: error loading package '': Encountered error while reading extension file 'kotlin/kotlin.bzl': no such package '#io_bazel_rules_kotlin//kotlin': error loading package 'external': Could not load //external package
INFO: Elapsed time: 0.061s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
WORKAROUND
Build branch:
androidx-test-1.3.0-beta01
Use bazel-2.2.0
bazel-2.2.0 build :axt_m2repository
This is the related issue in the android-test github issue tracker:
https://github.com/android/android-test/issues/626
Make sure that you're using the latest version of Bazel and the android-test repo.
The maven_jar native rule was removed in Bazel 2.0 (Bazel tracking ticket). Have you tried building with a Bazel version < 2.0 (e.g. 1.2.1)?

Unable to compile TensorFlow from source on an Intel i7 930 CPU; GTS-250 GPU

I'm new to TF and want to do a compile from source as my desktop does not have a CPU or GPU that supports AVX instructions. My system has an Intel i7 930 processor (Bloomfield from the nehalem family) and a Nvidea GTS-250 CPU. Yeah I know, both are getting long in the teeth.
The following is the full stack where I am failing in the process. I am following instructions from the following webpage.
https://www.tensorflow.org/install/source_windows
I pushed forward with the compile and ended up seeing the following errors...
H:\Python\TensorFlowCompile\tensorflow>python ./configure.py
WARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command "bazel shutdown".
You have bazel 0.29.1 installed.
Please specify the location of python. [Default is C:\Users\Zeek\AppData\Local\Programs\Python\Python37\python.exe]:
Found possible Python library paths:
C:\Users\Zeek\AppData\Local\Programs\Python\Python37\lib\site-packages
Please input the desired Python library path to use. Default is [C:\Users\Zeek\AppData\Local\Programs\Python\Python37\lib\site-packages]
Do you wish to build TensorFlow with XLA JIT support? [y/N]: N
No XLA JIT support will be enabled for TensorFlow.
Do you wish to build TensorFlow with ROCm support? [y/N]: N
No ROCm support will be enabled for TensorFlow.
Do you wish to build TensorFlow with CUDA support? [y/N]: N
No CUDA support will be enabled for TensorFlow.
Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is /arch:AVX]: --config=v2 -march=nehalem
Would you like to override eigen strong inline for some C++ compilation to reduce the compilation time? [Y/n]: Y
Eigen strong inline overridden.
Preconfigured Bazel build configs. You can use any of the below by adding "--config=<>" to your build command. See .bazelrc for more details.
--config=mkl # Build with MKL support.
--config=monolithic # Config for mostly static monolithic build.
--config=ngraph # Build with Intel nGraph support.
--config=numa # Build with NUMA support.
--config=dynamic_kernels # (Experimental) Build kernels into separate shared objects.
--config=v2 # Build TensorFlow 2.x instead of 1.x.
Preconfigured Bazel build configs to DISABLE default on features:
--config=noaws # Disable AWS S3 filesystem support.
--config=nogcp # Disable GCP support.
--config=nohdfs # Disable HDFS support.
--config=nonccl # Disable NVIDIA NCCL support.
H:\Python\TensorFlowCompile\tensorflow>bazel build //tensorflow/tools/pip_package:build_pip_package
Starting local Bazel server and connecting to it...
INFO: Options provided by the client:
Inherited 'common' options: --isatty=0 --terminal_columns=269
INFO: Options provided by the client:
'build' options: --python_path=C:/Users/Zeek/AppData/Local/Programs/Python/Python37/python.exe
INFO: Reading rc options for 'build' from h:\python\tensorflowcompile\tensorflow\.bazelrc:
'build' options: --apple_platform_type=macos --define framework_shared_object=true --define open_source_build=true --java_toolchain=//third_party/toolchains/java:tf_java_toolchain --host_java_toolchain=//third_party/toolchains/java:tf_java_toolchain --define=use_fast_cpp_protos=true --define=allow_oversize_protos=true --spawn_strategy=standalone --strategy=Genrule=standalone -c opt --cxxopt=-std=c++14 --host_cxxopt=-std=c++14 --announce_rc --define=grpc_no_ares=true --define=PREFIX=/usr --define=LIBDIR=$(PREFIX)/lib --define=INCLUDEDIR=$(PREFIX)/include --config=v2
INFO: Reading rc options for 'build' from h:\python\tensorflowcompile\tensorflow\.tf_configure.bazelrc:
'build' options: --action_env PYTHON_BIN_PATH=C:/Users/Zeek/AppData/Local/Programs/Python/Python37/python.exe --action_env PYTHON_LIB_PATH=C:/Users/Zeek/AppData/Local/Programs/Python/Python37/lib/site-packages --python_path=C:/Users/Zeek/AppData/Local/Programs/Python/Python37/python.exe --config monolithic --copt=-w --host_copt=-w --copt=-DWIN32_LEAN_AND_MEAN --host_copt=-DWIN32_LEAN_AND_MEAN --copt=-DNOGDI --host_copt=-DNOGDI --verbose_failures --distinct_host_configuration=false --define=override_eigen_strong_inline=true --action_env TF_CONFIGURE_IOS=0
INFO: Found applicable config definition build:v2 in file h:\python\tensorflowcompile\tensorflow\.bazelrc: --define=tf_api_version=2
INFO: Found applicable config definition build:monolithic in file h:\python\tensorflowcompile\tensorflow\.bazelrc: --define framework_shared_object=false
INFO: Found applicable config definition build:monolithic in file h:\python\tensorflowcompile\tensorflow\.bazelrc: --define framework_shared_object=false
Loading:
Loading: 0 packages loaded
Loading: 0 packages loaded
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (1 packages loaded, 0 targets configured)
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (6 packages loaded, 18 targets configured)
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (6 packages loaded, 18 targets configured)
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (6 packages loaded, 18 targets configured)
INFO: Call stack for the definition of repository 'com_google_protobuf' which is a tf_http_archive (rule definition at H:/python/tensorflowcompile/tensorflow/third_party/repo.bzl:121:19):
- H:/python/tensorflowcompile/tensorflow/tensorflow/workspace.bzl:434:5
- H:/python/tensorflowcompile/tensorflow/WORKSPACE:19:1
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (6 packages loaded, 18 targets configured)
INFO: Repository 'com_google_protobuf' used the following cache hits instead of downloading the corresponding file.
* Hash 'b9e92f9af8819bbbc514e2902aec860415b70209f31dfc8c4fa72515a5df9d59' for https://storage.googleapis.com/mirror.tensorflow.org/github.com/protocolbuffers/protobuf/archive/310ba5ee72661c081129eb878c1bbcec936b20f0.tar.gz
If the definition of 'com_google_protobuf' was updated, verify that the hashes were also updated.
ERROR: An error occurred during the fetch of repository 'com_google_protobuf':
Traceback (most recent call last):
File "H:/python/tensorflowcompile/tensorflow/third_party/repo.bzl", line 101
_apply_patch(ctx, ctx.attr.patch_file)
File "H:/python/tensorflowcompile/tensorflow/third_party/repo.bzl", line 68, in _apply_patch
_execute_and_check_ret_code(ctx, cmd)
File "H:/python/tensorflowcompile/tensorflow/third_party/repo.bzl", line 52, in _execute_and_check_ret_code
fail("Non-zero return code({1}) when ...))
Non-zero return code(127) when executing 'C:\msys64\usr\bin\bash.exe -l -c "patch" "-p1" "-d" "C:/users/Zeek/_bazel_Zeek/hfhzrtpt/external/com_google_protobuf" "-i" "H:/python/tensorflowcompile/tensorflow/third_party/protobuf/protobuf.patch"':
Stdout:
Stderr: /usr/bin/bash: patch: command not found
ERROR: Analysis of target '//tensorflow/tools/pip_package:build_pip_package' failed; build aborted: no such package '#com_google_protobuf//': Traceback (most recent call last):
File "H:/python/tensorflowcompile/tensorflow/third_party/repo.bzl", line 101
_apply_patch(ctx, ctx.attr.patch_file)
File "H:/python/tensorflowcompile/tensorflow/third_party/repo.bzl", line 68, in _apply_patch
_execute_and_check_ret_code(ctx, cmd)
File "H:/python/tensorflowcompile/tensorflow/third_party/repo.bzl", line 52, in _execute_and_check_ret_code
fail("Non-zero return code({1}) when ...))
Non-zero return code(127) when executing 'C:\msys64\usr\bin\bash.exe -l -c "patch" "-p1" "-d" "C:/users/Zeek/_bazel_Zeek/hfhzrtpt/external/com_google_protobuf" "-i" "H:/python/tensorflowcompile/tensorflow/third_party/protobuf/protobuf.patch"':
Stdout:
Stderr: /usr/bin/bash: patch: command not found
INFO: Elapsed time: 19.298s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (6 packages loaded, 18 targets configured)
FAILED: Build did NOT complete successfully (6 packages loaded, 18 targets configured)
I ran with a newer version of bazel prior to this compile and I was presented with the following error so that is why I reverted back to 0.29.1
H:\Python\TensorFlowCompile\tensorflow>python ./configure.py
Extracting Bazel installation...
WARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command "bazel shutdown".
You have bazel 1.0.1 installed.
Please downgrade your bazel installation to version 0.29.1 or lower to build TensorFlow! To downgrade: download the installer for the old version (from https://github.com/bazelbuild/bazel/releases) then run the installer.
Any thoughts on where I am going wrong, I am still pretty new at this so it's probably something pretty glaring/easy....
[Edit] this seemed to be resolved by setting up patch s it wasn't installed:
pacman -Syuu patch
**I pushed a bit farther and now I'm failing at the zip stage as follows.. **
INFO: Analyzed target //tensorflow/tools/pip_package:build_pip_package (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
[0 / 23] [Prepa] PythonZipper tensorflow/python/keras/api/create_tensorflow.python_api_1_keras_python_api_gen_compat_v1.zip ... (3 actions, 0 running)
ERROR: H:/python/tensorflowcompile/tensorflow/tensorflow/lite/python/BUILD:46:1: PythonZipper tensorflow/lite/python/tflite_convert.zip failed (Exit 255)
FATAL: MappedOutputFile(bazel-out/x64_windows-opt/bin/tensorflow/lite/python/tflite_convert.zip): CreateFileMapping failed
Target //tensorflow/tools/pip_package:build_pip_package failed to build
INFO: Elapsed time: 38.195s, Critical Path: 4.35s
INFO: 0 processes.
FAILED: Build did NOT complete successfully
FAILED: Build did NOT complete successfully
**I then tried to go back to the python config stage to make sure that I picked v2 and the proper family of CPU but when I redo the compile I see ANOTHER error where it is failing much sooner.. **
java.lang.RuntimeException: Unrecoverable error while evaluating node 'REPOSITORY_DIRECTORY:#local_config_cc' (requested by nodes 'REPOSITORY:#local_config_cc')
at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:528)
at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:399)
at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(Unknown Source)
at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Unknown Source)
at java.base/java.util.concurrent.ForkJoinPool.scan(Unknown Source)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)
Caused by: java.nio.file.InvalidPathException: Illegal char <> at index 60: C:/users/bill/_bazel_bill/hfhzrtpt/external/local_config_cc/*********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.0
** Copyright (c) 2017 Microsoft Corporation
C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Auxiliary/Build/VCVARSALL.BAT
at java.base/sun.nio.fs.WindowsPathParser.normalize(Unknown Source)
at java.base/sun.nio.fs.WindowsPathParser.parse(Unknown Source)
at java.base/sun.nio.fs.WindowsPathParser.parse(Unknown Source)
at java.base/sun.nio.fs.WindowsPath.parse(Unknown Source)
at java.base/sun.nio.fs.WindowsFileSystem.getPath(Unknown Source)
at java.base/java.nio.file.Path.of(Unknown Source)
at java.base/java.nio.file.Paths.get(Unknown Source)
at com.google.devtools.build.lib.vfs.JavaIoFileSystem.getNioPath(JavaIoFileSystem.java:84)
at com.google.devtools.build.lib.vfs.JavaIoFileSystem.exists(JavaIoFileSystem.java:119)
at com.google.devtools.build.lib.vfs.Path.exists(Path.java:356)
at com.google.devtools.build.lib.bazel.repository.skylark.SkylarkPath.exists(SkylarkPath.java:79)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at com.google.devtools.build.lib.syntax.MethodDescriptor.call(MethodDescriptor.java:135)
at com.google.devtools.build.lib.syntax.DotExpression.eval(DotExpression.java:126)
at com.google.devtools.build.lib.syntax.DotExpression.doEval(DotExpression.java:51)
at com.google.devtools.build.lib.syntax.Expression.eval(Expression.java:75)
at com.google.devtools.build.lib.syntax.UnaryOperatorExpression.doEval(UnaryOperatorExpression.java:98)
at com.google.devtools.build.lib.syntax.Expression.eval(Expression.java:75)
at com.google.devtools.build.lib.syntax.Eval.execIf(Eval.java:139)
at com.google.devtools.build.lib.syntax.Eval.execDispatch(Eval.java:214)
at com.google.devtools.build.lib.syntax.Eval.exec(Eval.java:183)
at com.google.devtools.build.lib.syntax.UserDefinedFunction.call(UserDefinedFunction.java:91)
at com.google.devtools.build.lib.syntax.BaseFunction.callWithArgArray(BaseFunction.java:474)
at com.google.devtools.build.lib.syntax.BaseFunction.call(BaseFunction.java:436)
at com.google.devtools.build.lib.syntax.FuncallExpression.callFunction(FuncallExpression.java:992)
at com.google.devtools.build.lib.syntax.FuncallExpression.doEval(FuncallExpression.java:904)
at com.google.devtools.build.lib.syntax.Expression.eval(Expression.java:75)
at com.google.devtools.build.lib.syntax.UnaryOperatorExpression.doEval(UnaryOperatorExpression.java:98)
at com.google.devtools.build.lib.syntax.Expression.eval(Expression.java:75)
at com.google.devtools.build.lib.syntax.Eval.execIf(Eval.java:139)
at com.google.devtools.build.lib.syntax.Eval.execDispatch(Eval.java:214)
at com.google.devtools.build.lib.syntax.Eval.exec(Eval.java:183)
at com.google.devtools.build.lib.syntax.UserDefinedFunction.call(UserDefinedFunction.java:91)
at com.google.devtools.build.lib.syntax.BaseFunction.callWithArgArray(BaseFunction.java:474)
at com.google.devtools.build.lib.syntax.BaseFunction.call(BaseFunction.java:436)
at com.google.devtools.build.lib.syntax.FuncallExpression.callFunction(FuncallExpression.java:992)
at com.google.devtools.build.lib.syntax.FuncallExpression.doEval(FuncallExpression.java:904)
at com.google.devtools.build.lib.syntax.Expression.eval(Expression.java:75)
at com.google.devtools.build.lib.syntax.Eval.execAssignment(Eval.java:72)
at com.google.devtools.build.lib.syntax.Eval.execDispatch(Eval.java:192)
at com.google.devtools.build.lib.syntax.Eval.exec(Eval.java:183)
at com.google.devtools.build.lib.syntax.Eval.execStatements(Eval.java:231)
at com.google.devtools.build.lib.syntax.Eval.execIf(Eval.java:144)
at com.google.devtools.build.lib.syntax.Eval.execDispatch(Eval.java:214)
at com.google.devtools.build.lib.syntax.Eval.exec(Eval.java:183)
at com.google.devtools.build.lib.syntax.UserDefinedFunction.call(UserDefinedFunction.java:91)
at com.google.devtools.build.lib.syntax.BaseFunction.callWithArgArray(BaseFunction.java:474)
at com.google.devtools.build.lib.syntax.BaseFunction.call(BaseFunction.java:436)
at com.google.devtools.build.lib.syntax.FuncallExpression.callFunction(FuncallExpression.java:992)
at com.google.devtools.build.lib.syntax.FuncallExpression.doEval(FuncallExpression.java:904)
at com.google.devtools.build.lib.syntax.Expression.eval(Expression.java:75)
at com.google.devtools.build.lib.syntax.Eval.execAssignment(Eval.java:72)
at com.google.devtools.build.lib.syntax.Eval.execDispatch(Eval.java:192)
at com.google.devtools.build.lib.syntax.Eval.exec(Eval.java:183)
at com.google.devtools.build.lib.syntax.UserDefinedFunction.call(UserDefinedFunction.java:91)
at com.google.devtools.build.lib.syntax.BaseFunction.callWithArgArray(BaseFunction.java:474)
at com.google.devtools.build.lib.syntax.BaseFunction.call(BaseFunction.java:436)
at com.google.devtools.build.lib.syntax.FuncallExpression.callFunction(FuncallExpression.java:992)
at com.google.devtools.build.lib.syntax.FuncallExpression.doEval(FuncallExpression.java:904)
at com.google.devtools.build.lib.syntax.Expression.eval(Expression.java:75)
at com.google.devtools.build.lib.syntax.Eval.execDispatch(Eval.java:201)
at com.google.devtools.build.lib.syntax.Eval.exec(Eval.java:183)
at com.google.devtools.build.lib.syntax.Eval.execStatements(Eval.java:231)
at com.google.devtools.build.lib.syntax.Eval.execIfBranch(Eval.java:83)
at com.google.devtools.build.lib.syntax.Eval.execDispatch(Eval.java:198)
at com.google.devtools.build.lib.syntax.Eval.exec(Eval.java:183)
at com.google.devtools.build.lib.syntax.Eval.execIf(Eval.java:140)
at com.google.devtools.build.lib.syntax.Eval.execDispatch(Eval.java:214)
at com.google.devtools.build.lib.syntax.Eval.exec(Eval.java:183)
at com.google.devtools.build.lib.syntax.UserDefinedFunction.call(UserDefinedFunction.java:91)
at com.google.devtools.build.lib.syntax.BaseFunction.callWithArgArray(BaseFunction.java:474)
at com.google.devtools.build.lib.syntax.BaseFunction.call(BaseFunction.java:436)
at com.google.devtools.build.lib.bazel.repository.skylark.SkylarkRepositoryFunction.fetch(SkylarkRepositoryFunction.java:173)
at com.google.devtools.build.lib.rules.repository.RepositoryDelegatorFunction.fetchRepository(RepositoryDelegatorFunction.java:298)
at com.google.devtools.build.lib.rules.repository.RepositoryDelegatorFunction.compute(RepositoryDelegatorFunction.java:225)
at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:451)
... 7 more
FAILED: Build did NOT complete successfully (231 packages loaded, 3779 targets configured)
WARNING: Waiting for server process to terminate (waited 5 seconds, waiting at most 60)
H:\Python\TensorFlowCompile\tensorflow>
Sorry folks I'm not sure where or how I show approach this one at this time... Is there a way to start the compile fresh, was there something that I missed that failed the pythonzip stage, was there a problem in my bezal config to start with....
TensorFlow doesn't yet support Bazel 1.x (it's coming, but not yet done), so yes you'll need 0.29.1 until then.
Set the environment variable to point to your VC directory, see "Installing and Using Bazel" > "Installing on Windows" > "Troubleshooting" > "Problem: Bazel does not find Visual Studio or Visual C++".
Start a normal cmd.exe shell, no need to run the Visual Studio command line.
Install Python modules required by TensorFlow: python -m pip install numpy keras_preprocessing
Configure TensorFlow: python configure.py
Build the pip module: bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package
Many thanks for the responses all. I was able to get TF working as listed above. I've sense upgraded the CPU and GPUs too!

Tensorflow 1.9 Bazel build error with Cuda on Windows

I'm trying to compile a sample program which uses Tensorflow core, with CUDA support on Windows 10 64bit via Bazel on the following environments:
Windows 10 64 bit
CUDA Toolkit 9.0
CUDNN 9.0
Tensorflow 1.9
Bazel 0.16
I went through the configure.py successfully, I added the CUDA and the CUDNN location.
This is my Bazel BUILD file:
cc_binary(
name = "mnistpredict.dll",
srcs = ["mnist.cc", "MNIST.h"],
deps = [
"//tensorflow/core:tensorflow",
],
linkshared=1
)
I try to compile with this command:
bazel build //tensorflow/loadgraph:mnistpredict.dll
ERROR:
C:/users/laci/downloads/tensorflow-1.9.0/tensorflow/loadgraph/BUILD:1:1:
error loading package 'tensorflow/core': Encountered error while
reading extension file 'cuda/build_defs.bzl': no such package
'#local_config_cuda//cuda': Traceback (most recent call last):
File "C:/users/laci/downloads/tensorflow-1.9.0/third_party/gpus/cuda_configure.bzl",
line 1166
_create_local_cuda_repository(repository_ctx)
File "C:/users/laci/downloads/tensorflow-1.9.0/third_party/gpus/cuda_configure.bzl",
line 995, in _create_local_cuda_repository
_get_cuda_config(repository_ctx)
File "C:/users/laci/downloads/tensorflow-1.9.0/third_party/gpus/cuda_configure.bzl",
line 750, in _get_cuda_config
_cudnn_version(repository_ctx, cudnn_install_base..., ...)
File "C:/users/laci/downloads/tensorflow-1.9.0/third_party/gpus/cuda_configure.bzl",
line 466, in _cudnn_version
find_cuda_define(repository_ctx, cudnn_header_dir, "c...", ...)
File "C:/users/laci/downloads/tensorflow-1.9.0/third_party/gpus/cuda_configure.bzl",
line 422, in find_cuda_define
auto_configure_fail(("Error reading %s: %s" % (str(h...)))
File "C:/users/laci/downloads/tensorflow-1.9.0/third_party/gpus/cuda_configure.bzl",
line 210, in auto_configure_fail
fail(("\n%sCuda Configuration Error:%...)))
Cuda Configuration Error: Error reading
C:/Users/laci/Downloads/cudnn-9.0-windows10-x64-v7.1/cuda/include/cudnn.h:
java.io.IOException: ERROR:
src/main/native/windows/processes-jni.cc(239): CreateProcessW("grep"
--color=never -A1 -E "#define CUDNN_MAJOR" C:/Users/laci/Downloads/cudnn-9.0-windows10-x64-v7.1/cuda/include/cudnn.h):
The system cannot find the file specified.
and referenced by '//tensorflow/loadgraph:mnistpredict.dll' ERROR:
Analysis of target '//tensorflow/loadgraph:mnistpredict.dll' failed;
build aborted: Analysis failed INFO: Elapsed time: 1.612s INFO: 0
processes. FAILED: Build did NOT complete successfully (2 packages
loaded)
currently loading: tensorflow/core
When I try it without CUDA support, I can compile it successfully.
It was looking for grep.exe under %PATH% but failed. Either adding Git\bin to %PATH% or install grep for Windows will do the trick.
It had taken me several days to finally build a tensorflow-gpu 1.10 whl on Windows 7 64 bit with bazel + msys2.

TF installation failure on ubuntu 14.04

I'm getting this weird config error I cannot decipher. It doesn't seem any other ppl has encountered this. CUDA is correctly config'ed. What is this 'repository_rule' and 'external' package thing?
(tensorflow)weiwe#weiwe:~/tensorflow$ ./configure
Please specify the location of python. [Default is /home/weiwe/tensorflow/bin/python]:
Do you wish to build TensorFlow with Google Cloud Platform support? [y/N]
No Google Cloud Platform support will be enabled for TensorFlow
Traceback (most recent call last):
File "<stdin>", line 18, in <module>
TypeError: can only concatenate list (not "str") to list
Found possible Python library paths:
Please input the desired Python library path to use. Default is []
/home/weiwe/tensorflow/lib/python2.7/site-packages
Do you wish to build TensorFlow with GPU support? [y/N] y
GPU support will be enabled for TensorFlow
Please specify which gcc should be used by nvcc as the host compiler. [Default is /usr/bin/gcc]:
Please specify the Cuda SDK version you want to use, e.g. 7.0. [Leave empty to use system default]:
Please specify the location where CUDA toolkit is installed. Refer to README.md for more details. [Default is /usr/local/cuda]:
Please specify the Cudnn version you want to use. [Leave empty to use system default]:
Please specify the location where cuDNN library is installed. Refer to README.md for more details. [Default is /usr/local/cuda]:
libcudnn.so resolves to libcudnn.4
Please specify a list of comma-separated Cuda compute capabilities you want to build with.
You can find the compute capability of your device at: https://developer.nvidia.com/cuda-gpus.
Please note that each additional compute capability significantly increases your build time and binary size.
[Default is: "3.5,5.2"]:
INFO: Starting clean (this may take a while). Consider using --expunge_async if the clean takes more than several minutes.
.........
ERROR: /home/weiwe/tensorflow/third_party/gpus/cuda_configure.bzl:415:18: function 'repository_rule' does not exist.
ERROR: com.google.devtools.build.lib.packages.BuildFileContainsErrorsException: error loading package 'external': Extension file '#local_config_cuda//cuda:build_defs.bzl' may not be loaded from a WORKSPACE file since the extension file is located in an external repository.
Configuration finished
(tensorflow)weiwe#weiwe:~/tensorflow$ bazel build -c opt --config=cuda \
> //tensorflow/tools/pip_package:build_pip_package
ERROR: com.google.devtools.build.lib.packages.BuildFileContainsErrorsException: error loading package 'external': Extension file '#local_config_cuda//cuda:build_defs.bzl' may not be loaded from a WORKSPACE file since the extension file is located in an external repository.
INFO: Elapsed time: 0.380s
(tensorflow)weiwe#weiwe:~/tensorflow$ bazel build -c opt --config=cuda //tensorflow/cc:tutorials_example_trainer
ERROR: com.google.devtools.build.lib.packages.BuildFileContainsErrorsException: error loading package 'external': Extension file '#local_config_cuda//cuda:build_defs.bzl' may not be loaded from a WORKSPACE file since the extension file is located in an external repository.
INFO: Elapsed time: 0.109s
(tensorflow)weiwe#weiwe:~/tensorflow$ bazel clean
INFO: Starting clean (this may take a while). Consider using --expunge_async if the clean takes more than several minutes.
(tensorflow)weiwe#weiwe:~/tensorflow$ bazel build -c opt --config=cuda //tensorflow/cc:tutorials_example_trainer
ERROR: com.google.devtools.build.lib.packages.BuildFileContainsErrorsException: error loading package 'external': Extension file '#local_config_cuda//cuda:build_defs.bzl' may not be loaded from a WORKSPACE file since the extension file is located in an external repository.
INFO: Elapsed time: 0.242s
There was a patch recently to the cuda build layer. Once you get that error
Error loading package 'external': Extension file '#local_config_cuda//cuda:build_defs.bzl' may not be loaded from a WORKSPACE file since the extension file is located in an external repository.
You have to re-run ./configure again to re-create that target.
This can become tiresome and a way to skip through the configuration process is to provide the variable settings from command line
PYTHON_BIN_PATH=$HOME/anaconda2/bin/python CUDA_TOOLKIT_PATH="/usr/local/cuda" CUDNN_INSTALL_PATH="/usr/local/cuda" TF_NEED_CUDA=1 TF_CUDA_COMPUTE_CAPABILITIES="6.1" TF_CUDNN_VERSION="5" TF_CUDA_VERSION="8.0" TF_CUDA_VERSION_TOOLKIT=8.0 ./configure
Hope it helps