Repository navigation
Description
As many may have this problem, I am unable to build tensorflow for Java in Windows. I need to build tensorflow for Java with GPU support in Windows. I followed all the directions specified, and I get the following error message:
Thank you!
$ bazel build --config opt //tensorflow/java:tensorflow //tensorflow/java:libtensorflow_jni
ERROR: C:/development/projects/tensorflow/tensorflow/java/BUILD:142:1: error loading package 'tensorflow/java/src/main/native': Encountered error while reading extension file 'cuda/build_defs.bzl': no such package '@local_config_cuda//cuda': Traceback (most recent call last):
File "C:/development/projects/tensorflow/third_party/gpus/cuda_configure.bzl", line 958
_create_cuda_repository(repository_ctx)
File "C:/development/projects/tensorflow/third_party/gpus/cuda_configure.bzl", line 846, in _create_cuda_repository
_get_cuda_config(repository_ctx)
File "C:/development/projects/tensorflow/third_party/gpus/cuda_configure.bzl", line 656, in _get_cuda_config
_cudnn_install_basedir(repository_ctx)
File "C:/development/projects/tensorflow/third_party/gpus/cuda_configure.bzl", line 211, in _cudnn_install_basedir
auto_configure_fail("Cannot find cudnn install path....)
File "C:/development/projects/tensorflow/third_party/gpus/cuda_configure.bzl", line 128, in auto_configure_fail
fail("
%sAuto-Configuration Error:%s ...))
Auto-Configuration Error: Cannot find cudnn install path.
and referenced by '//tensorflow/java:libtensorflow_jni.so'.
ERROR: Analysis of target '//tensorflow/java:libtensorflow_jni' failed; build aborted.
INFO: Elapsed time: 2.365s
Please go to Stack Overflow for help and support:
If you open a GitHub issue, here is our policy:
- It must be a bug or a feature request.
- The form below must be filled out.
Here's why we have that policy: TensorFlow developers respond to issues. We want to focus on work that benefits the whole community, e.g., fixing bugs and adding features. Support only helps individuals. GitHub also notifies thousands of people when issues are filed. We want them to see you communicating an interesting problem, rather than being redirected to Stack Overflow.
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, msys2 64bit
- TensorFlow installed from (source or binary): Source
- TensorFlow version (use command below): 1.1.0
- Bazel version (if compiling from source): 0.4.5
- CUDA/cuDNN version: 8.0/6.0
- GPU model and memory: Quadro K5200
- Exact command to reproduce: bazel build --config opt //tensorflow/java:tensorflow //tensorflow/java:libtensorflow_jni
You can collect some of this information using our environment capture script:
You can obtain the TensorFlow version with
python -c "import tensorflow as tf; print(tf.GIT_VERSION, tf.VERSION)"
Describe the problem
Describe the problem clearly here. Be sure to convey here why it's a bug in TensorFlow or a feature request.
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.
Activity
[-]Unable to build tensorflow for Java[/-][+]Unable to build tensorflow for Java in Windows[/+]wendal commentedon May 17, 2017
I use cmake , it works!
nectario commentedon May 17, 2017
I tried but cmake also failed for me... Can you give me instructions??
nectario commentedon May 17, 2017
CMAKE gives me the following errors:
The C compiler identification is MSVC 19.10.25019.0
The CXX compiler identification is MSVC 19.10.25019.0
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.10.25017/bin/Hostx86/x64/cl.exe
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.10.25017/bin/Hostx86/x64/cl.exe -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.10.25017/bin/Hostx86/x64/cl.exe
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.10.25017/bin/Hostx86/x64/cl.exe -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
Performing Test COMPILER_OPT_ARCH_NATIVE_SUPPORTED
Performing Test COMPILER_OPT_ARCH_NATIVE_SUPPORTED - Failed
Found PythonInterp: C:/ProgramData/Anaconda3/python.exe (found version "3.6")
Found PythonLibs: C:/ProgramData/Anaconda3/libs/python36.lib (found version "3.6.0")
CMake Error at C:/Program Files/CMake/share/cmake-3.8/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find SWIG (missing: SWIG_EXECUTABLE SWIG_DIR)
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.8/Modules/FindPackageHandleStandardArgs.cmake:377 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files/CMake/share/cmake-3.8/Modules/FindSWIG.cmake:63 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
tf_python.cmake:656 (find_package)
CMakeLists.txt:268 (include)
Configuring incomplete, errors occurred!
See also "C:/Temp/CMakeFiles/CMakeOutput.log".
See also "C:/Temp/CMakeFiles/CMakeError.log".
wendal commentedon May 17, 2017
you need swig
nectario commentedon May 17, 2017
Thanks. Let me install that.
nectario commentedon May 17, 2017
Now I get this:
(even though I have installed CUDNN).
CMake Error at CMakeLists.txt:221 (FILE):
file COPY cannot find "/include/cudnn.h".
Configuring incomplete, errors occurred!
See also "C:/Temp/CMakeFiles/CMakeOutput.log".
nectario commentedon May 17, 2017
Finally build it with CMAKE. So what do I do next to create the JNI libraries for Java?
nectario commentedon May 17, 2017
When I build it on Visual Studio I get:
187>Building Custom Rule C:/Development/Projects/tensorflow/tensorflow/contrib/cmake/CMakeLists.txt
185>Building Custom Rule C:/Development/Projects/tensorflow/tensorflow/contrib/cmake/CMakeLists.txt
186>Building Custom Rule C:/Development/Projects/tensorflow/tensorflow/contrib/cmake/CMakeLists.txt
185>CMake does not need to re-run because C:/Development/Projects/tensorflow/cmake_build/CMakeFiles/generate.stamp is up-to-date.
185>Building NVCC (Device) object CMakeFiles/cuda_compile_2.dir//rnn/kernels/Debug/cuda_compile_2_generated_lstm_ops_gpu.cu.cc.obj
187>CMake does not need to re-run because C:/Development/Projects/tensorflow/cmake_build/CMakeFiles/generate.stamp is up-to-date.
187>Building NVCC (Device) object CMakeFiles/cuda_compile_3.dir//seq2seq/kernels/Debug/cuda_compile_3_generated_beam_search_ops_gpu.cu.cc.obj
186>CMake does not need to re-run because C:/Development/Projects/tensorflow/cmake_build/CMakeFiles/generate.stamp is up-to-date.
186>Building NVCC (Device) object CMakeFiles/cuda_compile_1.dir//rnn/kernels/Debug/cuda_compile_1_generated_gru_ops_gpu.cu.cc.obj
185>Failed to run C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/bin (The system cannot find the file specified.
185>
185>).
185>CMake Error at cuda_compile_2_generated_lstm_ops_gpu.cu.cc.obj.Debug.cmake:222 (message):
185> Error generating
185> C:/Development/Projects/tensorflow/cmake_build/CMakeFiles/cuda_compile_2.dir//rnn/kernels/Debug/cuda_compile_2_generated_lstm_ops_gpu.cu.cc.obj
185>
185>
186>Failed to run C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/bin (The system cannot find the file specified.
186>
186>).
186>CMake Error at cuda_compile_1_generated_gru_ops_gpu.cu.cc.obj.Debug.cmake:222 (message):
186> Error generating
186> C:/Development/Projects/tensorflow/cmake_build/CMakeFiles/cuda_compile_1.dir//rnn/kernels/Debug/cuda_compile_1_generated_gru_ops_gpu.cu.cc.obj
186>
186>
187>Failed to run C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/bin (The system cannot find the file specified.
187>
187>).
187>CMake Error at cuda_compile_3_generated_beam_search_ops_gpu.cu.cc.obj.Debug.cmake:222 (message):
187> Error generating
187> C:/Development/Projects/tensorflow/cmake_build/CMakeFiles/cuda_compile_3.dir//seq2seq/kernels/Debug/cuda_compile_3_generated_beam_search_ops_gpu.cu.cc.obj
187>
187>
186>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(171,5): error MSB6006: "cmd.exe" exited with code 1.
186>Done building project "_gru_ops.vcxproj" -- FAILED.
187>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(171,5): error MSB6006: "cmd.exe" exited with code 1.
187>Done building project "_beam_search_ops.vcxproj" -- FAILED.
185>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(171,5): error MSB6006: "cmd.exe" exited with code 1.
185>Done building project "_lstm_ops.vcxproj" -- FAILED.
188>------ Build started: Project: tf_extension_ops, Configuration: Debug x64 ------
189>------ Skipped Build: Project: ALL_BUILD, Configuration: Debug x64 ------
189>Project not selected to build for this solution configuration
188>Building Custom Rule C:/Development/Projects/tensorflow/tensorflow/contrib/cmake/CMakeLists.txt
188>CMake does not need to re-run because C:/Development/Projects/tensorflow/cmake_build/CMakeFiles/generate.stamp is up-to-date.
190>------ Skipped Build: Project: tf_python_build_pip_package, Configuration: Debug x64 ------
190>Project not selected to build for this solution configuration
========== Build: 164 succeeded, 24 failed, 57 up-to-date, 2 skipped ==========
nectario commentedon May 17, 2017
I really need to build tensorflow for Java with GPU support in Windows, and unfortunately, it is an extremely frustrating experience. :-( :-( Is there any place I can download the gpu JNI lib that has been pre-built?
alive-zk commentedon May 17, 2017
This question is better asked on StackOverflow since it is not a bug or feature request. There is also a larger community that reads questions there. Thanks!
nectario commentedon May 18, 2017
Thank you, will do.
BensonBlack commentedon May 25, 2017
Now I get this:
(even though I have installed CUDNN).
CMake Error at CMakeLists.txt:221 (FILE):
file COPY cannot find "/include/cudnn.h".
Configuring incomplete, errors occurred!
See also "C:/Temp/CMakeFiles/CMakeOutput.log".
@nectario
How can you solve it?
nectario commentedon May 25, 2017
I am having a similar issue building but without cmake. Very frustrating experience. Nobody from stackoverflow responded. The build script seems extremely buggy.
wendal commentedon May 25, 2017
@nectario The CI is using cmake too.
nectario commentedon Jun 6, 2017
This is a valid issue that should not be closed. Stackoverflow did not respond not even once. Please open it. When I run this command:
bazel build --config opt //tensorflow/java:tensorflow //tensorflow/java:libtensorflow_jniI get:
lostmsu commentedon Aug 11, 2017
@nectario how did you end up solving CudNN.h problem? Is there a hidden property I need to set?
nectario commentedon Aug 12, 2017
I believe I had to set the property in cmake: CUDNN_HOME. I also set it as an environment variable. For example, my entry is:
CUDNN_HOME = C:/Program Files/NVIDIA GPU Computing Toolkit/CUDNN/5.1/cuda
Update XNNPACK in XLA
Update XNNPACK in XLA
Update XNNPACK in XLA
Update XNNPACK in XLA
Update XNNPACK in XLA
Update XNNPACK in XLA
Update XNNPACK in XLA
Update XNNPACK in XLA
Update XNNPACK in XLA