terryzhao127 / tensorflow-windows-build-script

A script to automate building Tensorflow on Windows and solve some problems
GNU General Public License v3.0
102 stars 35 forks source link

error:no such package '@png_archive//" #18

Open zg9uagfv opened 5 years ago

zg9uagfv commented 5 years ago

I have successfully compiled v1.11.0 version on win10. but I get an error "no such package '@png_archive//" when I compile v1.12.0 version.

### enviroment: vs2015, win10,python3.6.7,bazel1.15.0,cmake1.12.0

### cmd:

$parameterString = "--config=opt //tensorflow:libtensorflow_cc.so --verbose_failures"
.\build.ps1 `
    -BazelBuildParameters $parameterString `
    -BuildCppAPI -ReserveSource -ReserveVenv
PS C:\tensorflow_installation\tensorflow-windows-build-script> .\build.ps1 `
>>     -BazelBuildParameters $parameterString `
>>     -BuildCppAPI -ReserveSource -ReserveVenv

Select a Tensorflow version:
[1] 1 - v1.13.1  [2] 2 - v1.12.0  [3] 3 - v1.11.0  [S] Select another version  [?] : 2
Found chocolatey installed.
Found pacman installed.
Found patch installed.
Found unzip installed.
Found bazel installed.
Make sure you have installed same version of bazel 0.15.0.
Are you sure you want to PROCEED? [y/n]: y
Found cmake installed.
Make sure you have installed same version of cmake 3.12.
Are you sure you want to PROCEED? [y/n]: y
Found git installed.
Found python installed.
Make sure you have installed same version of python 3.6.7.
Are you sure you want to PROCEED? [y/n]: y
remote: Enumerating objects: 62, done.
remote: Counting objects: 100% (62/62), done.
remote: Compressing objects: 100% (44/44), done.
remote: Total 62 (delta 26), reused 42 (delta 18), pack-reused 0
Unpacking objects: 100% (62/62), done.
Note: checking out 'tags/v1.12.0'.
the parent control flow context is lost. (#23446)
Removing .tf_configure.bazelrc
Removing tensorflow/tf_exported_symbols_msvc.lds
Removing third_party/eigen_half.patch
Removing tools/python_bin_path.sh
warning: tensorflow/workspace.bzl has type 100644, expected 100755
Starting local Bazel server and connecting to it...
.............................................
INFO: Starting clean.
WARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command "bazel shutdown".
You have bazel 0.15.0 installed.
Invalid python path: C:/tensorflow_installation/tensorflow-windows-build-script/venv/Scripts/python.exe cannot be found.
Please specify the location of python. [Default is C:\Users\dh\AppData\Local\Programs\Python\Python36\python.exe]:

Do you wish to build TensorFlow with Apache Ignite support? [Y/n]: n
No Apache Ignite support will be enabled for TensorFlow.

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]:
Would you like to override eigen strong inline for some C++ compilation to reduce the compilation time? [Y/n]: y
Eigen strong inline overridden.

ERROR;

....................
DEBUG: C:/users/dh/_bazel_dh/qoon6usn/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/dh/_bazel_dh/qoon6usn/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/dh/_bazel_dh/qoon6usn/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: C:/tensorflow_installation/tensorflow-windows-build-script/source/tensorflow/core/platform/default/build_config/BUILD:188:1: no such package '@png_archive//': Traceback (most recent call last):
        File "C:/tensorflow_installation/tensorflow-windows-build-script/source/third_party/repo.bzl", line 106
                _apply_patch(ctx, ctx.attr.patch_file)
        File "C:/tensorflow_installation/tensorflow-windows-build-script/source/third_party/repo.bzl", line 73, in _apply_patch
                _execute_and_check_ret_code(ctx, cmd)
        File "C:/tensorflow_installation/tensorflow-windows-build-script/source/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/dh/_bazel_dh/qoon6usn/external/png_archive" "-i" "C:/tensorflow_installation/tensorflow-windows-build-script/source/third_party/png_fix_rpi.patch"':
Stdout:
Stderr: Timed out and referenced by '//tensorflow/core/platform/default/build_config:png'
ERROR: Analysis of target '//tensorflow:libtensorflow_cc.so' failed; build aborted: no such package '@png_archive//': Traceback (most recent call last):
        File "C:/tensorflow_installation/tensorflow-windows-build-script/source/third_party/repo.bzl", line 106
                _apply_patch(ctx, ctx.attr.patch_file)
        File "C:/tensorflow_installation/tensorflow-windows-build-script/source/third_party/repo.bzl", line 73, in _apply_patch
                _execute_and_check_ret_code(ctx, cmd)
        File "C:/tensorflow_installation/tensorflow-windows-build-script/source/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/dh/_bazel_dh/qoon6usn/external/png_archive" "-i" "C:/tensorflow_installation/tensorflow-windows-build-script/source/third_party/png_fix_rpi.patch"':
Stdout:
Stderr: Timed out
INFO: Elapsed time: 188.657s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (68 packages loaded)
terryzhao127 commented 5 years ago

Seems similar to #16.

@ihuale How did you solve it?

terryzhao127 commented 5 years ago

By the way, you reminded me that now CMake is not used which was used to compile protobuf.

ihuale commented 5 years ago

i didn't solve it, i still can't build

rbgreenway commented 5 years ago

Not sure this will work for all cases, but I also ran into this "png_archive" issue, and it turned out that the path to bash used by the script was wrong. This caused a failure when trying to run the patch file needed: png_fix_rpi.patch.

The error given in your comment says that it was looking for bash.exe in: C:\msys64\usr\bin\bash.exe If this is the wrong path to your bash.exe, you need to manually change it in the build.ps1 script. It had to be changed in 3 places.

For my system, the correct path was: C:\bin\msys64\usr\bin\bash.exe

$ENV:Path += ";C:\bin\msys64\usr\bin"
$ENV:BAZEL_SH = "C:\bin\msys64\usr\bin\bash.exe"

if (!(CheckInstalled pacman)) {
    $version = askForVersion "20180531.0.0"
    choco install msys2 --version $version --params "/NoUpdate /InstallDir:C:\bin\msys64"
}

In the code snippet above, you can see the path in 3 places (partial path in one of them). Search for this in build.ps1 and make sure it's correct.

This fixed it for me.

reissgo commented 5 years ago

I also got no such package '@png_archive//':

After seeing rbgreenway's comment I checked and C:\msys64\usr\bin\ is indeed the correct directory for bash.exe

Below is the complete output from my script (with some key parts in bold)

--

(venv) PS C:\tf_windows_build\tensorflow-windows-build-script-master> .\build.ps1 -BazelBuildParameters //tensorflow:libtensorflow_cc.so -BuildCppAPI

Select a Tensorflow version: [1] 1 - v1.13.1 [2] 2 - v1.12.0 [3] 3 - v1.11.0 [S] Select another version [?] Help (default is "1"): 1 Found chocolatey installed. Found pacman installed. Found patch installed. Found unzip installed. Found bazel installed. Make sure you have installed same version of bazel 0.20.0. Are you sure you want to PROCEED? [y/n]: y Found git installed. Found python installed. Make sure you have installed same version of python 3.6.7. Are you sure you want to PROCEED? [y/n]: y Cloning into 'tensorflow'... remote: Enumerating objects: 7, done. remote: Counting objects: 100% (7/7), done. remote: Compressing objects: 100% (7/7), done. remote: Total 635953 (delta 0), reused 1 (delta 0), pack-reused 635946 Receiving objects: 100% (635953/635953), 360.84 MiB | 8.07 MiB/s, done. Resolving deltas: 100% (515200/515200), done. Checking out files: 100% (17898/17898), done. Checking out files: 100% (11262/11262), done. Note: checking out 'tags/v1.13.1'.

You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may do so (now or later) by using -b with the checkout command again. Example:

git checkout -b

HEAD is now at 6612da8951 Merge pull request #26101 from gunan/r1.13 Checking patch tensorflow/core/framework/op_kernel.h... Applied patch tensorflow/core/framework/op_kernel.h cleanly. Collecting six Using cached https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl Collecting numpy Using cached https://files.pythonhosted.org/packages/ce/61/be72eee50f042db3acf0b1fb86650ad36d6c0d9be9fc29f8505d3b9d6baa/numpy-1.16.4-cp37-cp37m-win_amd64.whl Collecting wheel Using cached https://files.pythonhosted.org/packages/bb/10/44230dd6bf3563b8f227dbf344c908d412ad2ff48066476672f3a72e174e/wheel-0.33.4-py2.py3-none-any.whl Installing collected packages: six, numpy, wheel Successfully installed numpy-1.16.4 six-1.12.0 wheel-0.33.4 You are using pip version 19.0.3, however version 19.2.1 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command. Collecting keras_applications==1.0.5 Using cached https://files.pythonhosted.org/packages/3f/9c/6e9393ead970fd97be0cfde912697dafec5800d9191f5ba25352fa537d72/Keras_Applications-1.0.5-py2.py3-none-any.whl Installing collected packages: keras-applications Successfully installed keras-applications-1.0.5 You are using pip version 19.0.3, however version 19.2.1 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command. Collecting keras_preprocessing==1.0.3 Using cached https://files.pythonhosted.org/packages/b3/bd/796f986980da4d6adc77ffd8b2b11074e7b17a7b74b03789aefac5709c4b/Keras_Preprocessing-1.0.3-py2.py3-none-any.whl Installing collected packages: keras-preprocessing Successfully installed keras-preprocessing-1.0.3 You are using pip version 19.0.3, however version 19.2.1 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command. 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: nul WARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command "bazel shutdown". INFO: Invocation ID: 73739970-df39-4a41-bf08-2e635bd31783 You have bazel 0.20.0 installed. 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]:

Would you like to override eigen strong inline for some C++ compilation to reduce the compilation time? [Y/n]: n Not overriding eigen strong inline, some compilations could take more than 20 mins.

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=gdr # Build with GDR support. --config=verbs # Build with libverbs support. --config=ngraph # Build with Intel nGraph support. --config=dynamic_kernels # (Experimental) Build kernels into separate shared objects. 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=noignite # Disable Apacha Ignite support. --config=nokafka # Disable Apache Kafka support. --config=nonccl # Disable NVIDIA NCCL support. 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: c:\tf_windows_build\tensorflow-windows-build-script-master\source/.bazelrc Starting local Bazel server and connecting to it... WARNING: Option 'experimental_shortened_obj_file_path' is deprecated INFO: Invocation ID: af13912b-1391-408e-8641-4b24e2b44a6e ERROR: C:/tf_windows_build/tensorflow-windows-build-script-master/source/tensorflow/core/platform/default/build_config/BUILD:188:1: no such package '@png_archive//': Traceback (most recent call last): File "C:/tf_windows_build/tensorflow-windows-build-script-master/source/third_party/repo.bzl", line 106 _apply_patch(ctx, ctx.attr.patch_file) File "C:/tf_windows_build/tensorflow-windows-build-script-master/source/third_party/repo.bzl", line 73, in _apply_patch _execute_and_check_ret_code(ctx, cmd) File "C:/tf_windows_build/tensorflow-windows-build-script-master/source/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/mick/_bazel_mick/mgbyyune/external/png_archive" "-i" "C:/tf_windows_build/tensorflow-windows-build-script-master/source/third_party/png_fix_rpi.patch"': Stdout: Stderr: /usr/bin/bash: patch: command not found and referenced by '//tensorflow/core/platform/default/build_config:png' ERROR: Analysis of target '//tensorflow:libtensorflow_cc.so' failed; build aborted: Analysis failed INFO: Elapsed time: 19.181s INFO: 0 processes. FAILED: Build did NOT complete successfully (94 packages loaded, 5818 targets configured) Fetching @grpc; fetching 12s Fetching @png_archive; fetching 9s Fetching @icu; fetching 9s 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: c:\tf_windows_build\tensorflow-windows-build-script-master\source/.bazelrc INFO: Invocation ID: cac1adeb-3ca0-4cba-8d10-428088c500d3 (venv) PS C:\tf_windows_build\tensorflow-windows-build-script-master>

pjhdekoning commented 5 years ago

I had the same problem, solved it by running 'pacman -S patch' to install the patch command in msys2. Somehow the build.ps1 script thinks 'patch' is available (line 114) but it isn't actually there. Maybe because it is present as a bash-completion?

amitpandey2194 commented 4 years ago

I faced the same issue and ran pacman -S patch in msys2 and it worked for me as well as @pjhdekoning mentioned. This was for tensorflow v1.12.0, doing bazel 0.15.0 build, Visual Studio 14.