tensorflow: Error building on Windows, patch command failing
System information
- Have I written custom code (as opposed to using a stock example script provided in TensorFlow): No
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 10
- Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: N/A
- TensorFlow installed from (source or binary): source
- TensorFlow version (use command below): 1.10
- Python version: 3.6.6
- Bazel version (if compiling from source): 0.17.2
- GCC/Compiler version (if compiling from source): Visual C++ Build Tools 2015
- CUDA/cuDNN version: N/A
- GPU model and memory: N/A
- Exact command to reproduce: Follow build instructions on https://www.tensorflow.org/install/source_windows
Describe the problem
Describe the problem clearly here. Be sure to convey here why it’s a bug in TensorFlow or a feature request.
When following the build instructions on https://www.tensorflow.org/install/source_windows I am unable to build tensorflow from source. I’m running on a clean Windows 10 install (nothing else installed but the requirements listed on the homepage).
When running the bazel build step (CPU) with the command: $ bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package I get two different errors, both when the build script tries to patch some files. The commands that fail are:
C:\msys64\usr\bin\bash.exe -l -c patch -p1 -d C:/users/cm/_bazel_cm/xv6zejqw/external/kafka -i C:/tensorflow/third_party/kafka/config.patch C:\msys64\usr\bin\bash.exe -l -c patch -p1 -d C:/users/cm/_bazel_cm/xv6zejqw/external/png_archive -i C:/tensorflow/third_party/png_fix_rpi.patch
Copying the patch commands into the cmd.exe prompt makes the patch command “hang” until I manually terminate it. If I add ’ ’ around the command part of the bash invocation (e.g. bash -c ‘patch …’) it works just fine.
Source code / logs
Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached. Try to provide a reproducible test case that is the bare minimum necessary to generate the problem.
`$ bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package
Starting local Bazel server and connecting to it…
DEBUG: C:/users/cm/_bazel_cm/xv6zejqw/external/bazel_tools/tools/cpp/lib_cc_configure.bzl:115:5:
Auto-Configuration Warning: ‘BAZEL_VC’ is not set, start looking for the latest Visual C++ installed.
DEBUG: C:/users/cm/_bazel_cm/xv6zejqw/external/bazel_tools/tools/cpp/lib_cc_configure.bzl:115:5:
Auto-Configuration Warning: Looking for VS%VERSION%COMNTOOLS environment variables, eg. VS140COMNTOOLS
DEBUG: C:/users/cm/_bazel_cm/xv6zejqw/external/bazel_tools/tools/cpp/lib_cc_configure.bzl:115:5:
Auto-Configuration Warning: Visual C++ build tools found at C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC
ERROR: Analysis of target ‘//tensorflow/tools/pip_package:build_pip_package’ failed; build aborted: no such package ‘@kafka//’: Traceback (most recent call last):
File “C:/tensorflow/third_party/repo.bzl”, line 99
_apply_patch(ctx, ctx.attr.patch_file)
File “C:/tensorflow/third_party/repo.bzl”, line 67, in _apply_patch
_execute_and_check_ret_code(ctx, cmd)
File “C:/tensorflow/third_party/repo.bzl”, line 52, in _execute_and_check_ret_code
fail("Non-zero return code({1}) when …))
Non-zero return code(256) when executing ‘C:\msys64\usr\bin\bash.exe -l -c patch -p1 -d C:/users/cm/_bazel_cm/xv6zejqw/external/kafka -i C:/tensorflow/third_party/kafka/config.patch’:
Stdout:
Stderr: Timed out
INFO: Elapsed time: 93,541s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (242 packages loaded)
cm@tbuilder /c/tensorflow
$ bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package
DEBUG: C:/users/cm/_bazel_cm/xv6zejqw/external/bazel_tools/tools/cpp/lib_cc_configure.bzl:115:5:
Auto-Configuration Warning: ‘BAZEL_VC’ is not set, start looking for the latest Visual C++ installed.
DEBUG: C:/users/cm/_bazel_cm/xv6zejqw/external/bazel_tools/tools/cpp/lib_cc_configure.bzl:115:5:
Auto-Configuration Warning: Looking for VS%VERSION%COMNTOOLS environment variables, eg. VS140COMNTOOLS
DEBUG: C:/users/cm/_bazel_cm/xv6zejqw/external/bazel_tools/tools/cpp/lib_cc_configure.bzl:115:5:
Auto-Configuration Warning: Visual C++ build tools found at C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC
ERROR: Analysis of target ‘//tensorflow/tools/pip_package:build_pip_package’ failed; build aborted: no such package ‘@png_archive//’: Traceback (most recent call last):
File “C:/tensorflow/third_party/repo.bzl”, line 99
_apply_patch(ctx, ctx.attr.patch_file)
File “C:/tensorflow/third_party/repo.bzl”, line 67, in _apply_patch
_execute_and_check_ret_code(ctx, cmd)
File “C:/tensorflow/third_party/repo.bzl”, line 52, in _execute_and_check_ret_code
fail("Non-zero return code({1}) when …))
Non-zero return code(256) when executing ‘C:\msys64\usr\bin\bash.exe -l -c patch -p1 -d C:/users/cm/_bazel_cm/xv6zejqw/external/png_archive -i C:/tensorflow/third_party/png_fix_rpi.patch’:
Stdout:
Stderr: Timed out
INFO: Elapsed time: 33,880s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)`
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 23 (4 by maintainers)
Commits related to this issue
- repo.bzl: Increase timeout of repo_ctx.execute patch command can exceed the 10s timeout limit on some slow machines. Fixes #22761 PiperOrigin-RevId: 216721485 — committed to benjamintanweihao/tensorflow by tensorflower-gardener 6 years ago
- repo.bzl: Increase timeout of repo_ctx.execute patch command can exceed the 10s timeout limit on some slow machines. Fixes #22761 PiperOrigin-RevId: 216721485 — committed to benjamintanweihao/tensorflow by tensorflower-gardener 6 years ago
@bjepson - In repo.bzl, you can try changing code in function: _wrap_bash_cmd Change the line:
cmd = [bazel_sh, "-l", "-c", " ".join(cmd)]To be:cmd = [bazel_sh, "-l", "-c", '"' + " ".join(cmd) + '"']I still ran into different issue anyway. May be what we see in output log is not accurate?
The modification that seems to unblock my build is simply increasing timeout in function: _execute_and_check_ret_code From:
result = repo_ctx.execute(cmd_and_args, timeout = 10)To be:result = repo_ctx.execute(cmd_and_args, timeout = 100)Seem like bazel is utilizing machine resource and shell execution cannot complete task on time in some machines. Increasing the timeout seems to help.
@madsdk - Seeing from you log:
Non-zero return code(127) when executing 'C:\msys64\usr\bin\bash.exe -l -c "patch -p1 -d C:/users/cm/_bazel_cm/xv6zejqw/external/kafka -i C:/tensorflow/third_party/kafka/config.patch"'Please make sure that you don’t add single quote or double quote to "repo.bzl ". The only necessary change seems to be Timeout value. Adding quote/double quote will generate ‘No such file or directory’ error. From what I found, the original line below is correct:cmd = [bazel_sh, "-l", "-c", " ".join(cmd)]@twilightdema Thanks for the solution! I’ll send a PR to increase the timeout!