<h3 dir="auto">System information</h3>
<ul dir="auto">
<li><strong>Have I written custom code (as opposed to using a stock example script provided in TensorFlow)</strong>: No</li>
<li><strong>OS Platform and Distribution (e.g., Linux Ubuntu 16.04)</strong>: Ubuntu 16.04.4</li>
<li><strong>TensorFlow installed from (source or binary)</strong>: source</li>
<li><strong>TensorFlow version (use command below)</strong>:</li>
<li><strong>Python version</strong>:</li>
<li><strong>Bazel version (if compiling from source)</strong>: 0.5.3</li>
<li><strong>CUDA/cuDNN version</strong>: 6.0.21</li>
<li><strong>GPU model and memory</strong>:</li>
<li><strong>Exact command to reproduce</strong>: bazel build --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package</li>
</ul>
<h3 dir="auto">Describe the problem</h3>
<p dir="auto">I know someone had reported the same issue. Their solution is to roll back bazel to 0.5.2. But it does not work on my machine. Does anyone know how to fix this problem without the need of rolling back bazel? Thx!</p>
<blockquote>
<p dir="auto">tensorflow-git$ sudo bazel build --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package<br>
WARNING: ignoring http_proxy in environment.<br>
.......<br>
ERROR: Skipping '//tensorflow/tools/pip_package:build_pip_package': error loading package 'tensorflow/tools/pip_package': Encountered error while reading extension file 'cuda/build_defs.bzl': no such package '@local_config_cuda//cuda': Traceback (most recent call last):<br>
File "/home/intel/DevLib/tensorflow-git/third_party/gpus/cuda_configure.bzl", line 1039<br>
_create_local_cuda_repository(repository_ctx)<br>
File "/home/intel/DevLib/tensorflow-git/third_party/gpus/cuda_configure.bzl", line 976, in _create_local_cuda_repository<br>
_host_compiler_includes(repository_ctx, cc)<br>
File "/home/intel/DevLib/tensorflow-git/third_party/gpus/cuda_configure.bzl", line 145, in _host_compiler_includes<br>
get_cxx_inc_directories(repository_ctx, cc)<br>
File "/home/intel/DevLib/tensorflow-git/third_party/gpus/cuda_configure.bzl", line 120, in get_cxx_inc_directories<br>
set(includes_cpp)<br>
depsets cannot contain mutable items<br>
WARNING: Target pattern parsing failed.<br>
ERROR: error loading package 'tensorflow/tools/pip_package': Encountered error while reading extension file 'cuda/build_defs.bzl': no such package '@local_config_cuda//cuda': Traceback (most recent call last):<br>
File "/home/intel/DevLib/tensorflow-git/third_party/gpus/cuda_configure.bzl", line 1039<br>
_create_local_cuda_repository(repository_ctx)<br>
File "/home/intel/DevLib/tensorflow-git/third_party/gpus/cuda_configure.bzl", line 976, in _create_local_cuda_repository<br>
_host_compiler_includes(repository_ctx, cc)<br>
File "/home/intel/DevLib/tensorflow-git/third_party/gpus/cuda_configure.bzl", line 145, in _host_compiler_includes<br>
get_cxx_inc_directories(repository_ctx, cc)<br>
File "/home/intel/DevLib/tensorflow-git/third_party/gpus/cuda_configure.bzl", line 120, in get_cxx_inc_directories<br>
set(includes_cpp)<br>
depsets cannot contain mutable items<br>
INFO: Elapsed time: 4.064s<br>
FAILED: Build did NOT complete successfully (0 packages loaded)<br>
currently loading: tensorflow/tools/pip_package</p>
</blockquote>
<p dir="auto">Please go to Stack Overflow for help and support:</p>
<h3 dir="auto">System information</h3>
<ul dir="auto">
<li><strong>Have I written custom code (as opposed to using a stock example script provided in TensorFlow)</strong>:</li>
</ul>
<p dir="auto">No</p>
<ul dir="auto">
<li><strong>OS Platform and Distribution (e.g., Linux Ubuntu 16.04)</strong>:</li>
</ul>
<p dir="auto">Linux — Ubuntu Server 16.04 LTS</p>
<p dir="auto">Linux PowerEdge-R810 4.4.0-87-generic <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="116236573" data-permission-text="Title is private" data-url="https://github.com/tensorflow/tensorflow/issues/110" data-hovercard-type="issue" data-hovercard-url="/tensorflow/tensorflow/issues/110/hovercard" href="https://github.com/tensorflow/tensorflow/issues/110">#110</a>-Ubuntu SMP Tue Jul 18 12:55:35 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux</p>
<ul dir="auto">
<li><strong>TensorFlow installed from (source or binary)</strong>:</li>
</ul>
<p dir="auto">Source</p>
<ul dir="auto">
<li><strong>TensorFlow version (use command below)</strong>:</li>
</ul>
<p dir="auto">master, r1.3, r1.2.1</p>
<ul dir="auto">
<li><strong>Python version</strong>:</li>
</ul>
<p dir="auto">2.7</p>
<ul dir="auto">
<li><strong>Bazel version (if compiling from source)</strong>:</li>
</ul>
<p dir="auto">Build label: 0.5.3<br>
Build target: bazel-out/local-fastbuild/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar<br>
Build time: Fri Jul 28 08:34:59 2017 (1501230899)<br>
Build timestamp: 1501230899<br>
Build timestamp as int: 1501230899</p>
<ul dir="auto">
<li><strong>CUDA/cuDNN version</strong>:</li>
</ul>
<p dir="auto">CUDA 8, cuDNN 6</p>
<ul dir="auto">
<li><strong>GPU model and memory</strong>:</li>
</ul>
<p dir="auto">GTX 1080, 8gb</p>
<ul dir="auto">
<li><strong>Exact command to reproduce</strong>:</li>
</ul>
<p dir="auto"><code class="notranslate">./configure;bazel build -c opt —config=cuda //tensorflow/tools/pip_package:build_pip_package</code></p>
<p dir="auto">-<strong>Premade script</strong>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="alex@PowerEdge-R810:~$ sh tf_env_collect.sh 
Collecting system information...
tf_env_collect.sh: 39: [: Linux: unexpected operator
tf_env_collect.sh: 41: [: Linux: unexpected operator
Traceback (most recent call last):
  File &quot;/tmp/check_tf.py&quot;, line 1, in &lt;module&gt;
    import tensorflow as tf;
ImportError: No module named tensorflow
Wrote environment to tf_env.txt. You can review the contents of that file.
and use it to populate the fields in the github issue template.

cat tf_env.txt

alex@PowerEdge-R810:~$ cat tf_env.txt

== cat /etc/issue ===============================================
Linux PowerEdge-R810 4.4.0-87-generic #110-Ubuntu SMP Tue Jul 18 12:55:35 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

== are we in docker =============================================
No

== compiler =====================================================
c++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


== uname -a =====================================================
Linux PowerEdge-R810 4.4.0-87-generic #110-Ubuntu SMP Tue Jul 18 12:55:35 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

== check pips ===================================================
numpy (1.11.0)

== check for virtualenv =========================================
False

== tensorflow import ============================================
Traceback (most recent call last):
  File &quot;&lt;string&gt;&quot;, line 1, in &lt;module&gt;
ImportError: No module named tensorflow

== env ==========================================================
LD_LIBRARY_PATH /usr/local/cuda-8.0/lib64
DYLD_LIBRARY_PATH is unset

== nvidia-smi ===================================================
Fri Jul 28 18:12:37 2017       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 384.59                 Driver Version: 384.59                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 1080    Off  | 00000000:0E:00.0 Off |                  N/A |
| 37%   32C    P0    32W / 180W |      0MiB /  8105MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID  Type  Process name                               Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

== cuda libs  ===================================================
/usr/local/cuda-8.0/lib64/libcudart_static.a
/usr/local/cuda-8.0/lib64/libcudart.so.8.0.61
/usr/local/cuda-8.0/doc/man/man7/libcudart.7
/usr/local/cuda-8.0/doc/man/man7/libcudart.so.7"><pre class="notranslate"><code class="notranslate">alex@PowerEdge-R810:~$ sh tf_env_collect.sh 
Collecting system information...
tf_env_collect.sh: 39: [: Linux: unexpected operator
tf_env_collect.sh: 41: [: Linux: unexpected operator
Traceback (most recent call last):
  File "/tmp/check_tf.py", line 1, in &lt;module&gt;
    import tensorflow as tf;
ImportError: No module named tensorflow
Wrote environment to tf_env.txt. You can review the contents of that file.
and use it to populate the fields in the github issue template.

cat tf_env.txt

alex@PowerEdge-R810:~$ cat tf_env.txt

== cat /etc/issue ===============================================
Linux PowerEdge-R810 4.4.0-87-generic #110-Ubuntu SMP Tue Jul 18 12:55:35 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

== are we in docker =============================================
No

== compiler =====================================================
c++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


== uname -a =====================================================
Linux PowerEdge-R810 4.4.0-87-generic #110-Ubuntu SMP Tue Jul 18 12:55:35 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

== check pips ===================================================
numpy (1.11.0)

== check for virtualenv =========================================
False

== tensorflow import ============================================
Traceback (most recent call last):
  File "&lt;string&gt;", line 1, in &lt;module&gt;
ImportError: No module named tensorflow

== env ==========================================================
LD_LIBRARY_PATH /usr/local/cuda-8.0/lib64
DYLD_LIBRARY_PATH is unset

== nvidia-smi ===================================================
Fri Jul 28 18:12:37 2017       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 384.59                 Driver Version: 384.59                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 1080    Off  | 00000000:0E:00.0 Off |                  N/A |
| 37%   32C    P0    32W / 180W |      0MiB /  8105MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID  Type  Process name                               Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

== cuda libs  ===================================================
/usr/local/cuda-8.0/lib64/libcudart_static.a
/usr/local/cuda-8.0/lib64/libcudart.so.8.0.61
/usr/local/cuda-8.0/doc/man/man7/libcudart.7
/usr/local/cuda-8.0/doc/man/man7/libcudart.so.7
</code></pre></div>
<h3 dir="auto">Describe the problem</h3>
<p dir="auto">I am trying to compile tensorflow from source. When I run the above command, the bazel build fails. This is the configuration I used as well as the error. It seems like some other people had this issue but the threads were for much older versions and none of the solutions fixed it:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Please specify the location of python. [Default is /usr/bin/python]: 
Found possible Python library paths:
/usr/local/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages
Please input the desired Python library path to use.  Default is /usr/local/lib/python2.7/dist-packages
Do you wish to build TensorFlow with jemalloc as malloc support? [Y/n]: 
jemalloc as malloc support will be enabled for TensorFlow.

Do you wish to build TensorFlow with Google Cloud Platform support? [y/N]: y
Google Cloud Platform support will be enabled for TensorFlow.

Do you wish to build TensorFlow with Hadoop File System support? [y/N]: 
No Hadoop File System support will be enabled for TensorFlow.

Do you wish to build TensorFlow with XLA JIT support? [y/N]: 
No XLA JIT support will be enabled for TensorFlow.

Do you wish to build TensorFlow with VERBS support? [y/N]: 
No VERBS support will be enabled for TensorFlow.

Do you wish to build TensorFlow with OpenCL support? [y/N]: y
OpenCL support will be enabled for TensorFlow.

Please specify which C++ compiler should be used as the host C++ compiler. [Default is /usr/bin/g++]: 
Please specify which C compiler should be used as the host C compiler. [Default is /usr/bin/gcc]: 
Please specify the location where ComputeCpp for SYCL 1.2 is installed. [Default is /usr/local/computecpp]: 
Do you wish to build TensorFlow with CUDA support? [y/N]: y
CUDA support will be enabled for TensorFlow.

Please specify the CUDA SDK version you want to use, e.g. 7.0. [Leave empty to default to CUDA 8.0]: 
Please specify the location where CUDA 8.0 toolkit is installed. Refer to README.md for more details. [Default is /usr/local/cuda]: 
&quot;Please specify the cuDNN version you want to use. [Leave empty to default to cuDNN 6.0]: 
Please specify the location where cuDNN 6 library is installed. Refer to README.md for more details. [Default is /usr/local/cuda]:
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: 6.1]
Do you want to use clang as CUDA compiler? [y/N]: 
nvcc will be used as CUDA compiler.

Please specify which gcc should be used by nvcc as the host compiler. [Default is /usr/bin/gcc]: 
Do you wish to build TensorFlow with MPI support? [y/N]: 
No MPI support will be enabled for TensorFlow.

Please specify optimization flags to use during compilation when bazel option &quot;--config=opt&quot; is specified [Default is -march=native]: 
Add &quot;--config=mkl&quot; to your bazel command to build with MKL support.
Please note that MKL on MacOS or windows is still not supported.
If you would like to use a local MKL instead of downloading, please set the environment variable &quot;TF_MKL_ROOT&quot; every time before build.
Configuration finished
...............
ERROR: Skipping '//tensorflow/tools/pip_package:build_pip_package': error loading package 'tensorflow/tools/pip_package': Encountered error while reading extension file 'cuda/build_defs.bzl': no such package '@local_config_cuda//cuda': Traceback (most recent call last):
	File &quot;/home/alex/tensorflow/third_party/gpus/cuda_configure.bzl&quot;, line 1039
		_create_local_cuda_repository(repository_ctx)
	File &quot;/home/alex/tensorflow/third_party/gpus/cuda_configure.bzl&quot;, line 976, in _create_local_cuda_repository
		_host_compiler_includes(repository_ctx, cc)
	File &quot;/home/alex/tensorflow/third_party/gpus/cuda_configure.bzl&quot;, line 145, in _host_compiler_includes
		get_cxx_inc_directories(repository_ctx, cc)
	File &quot;/home/alex/tensorflow/third_party/gpus/cuda_configure.bzl&quot;, line 120, in get_cxx_inc_directories
		set(includes_cpp)
depsets cannot contain mutable items
WARNING: Target pattern parsing failed.
ERROR: error loading package 'tensorflow/tools/pip_package': Encountered error while reading extension file 'cuda/build_defs.bzl': no such package '@local_config_cuda//cuda': Traceback (most recent call last):
	File &quot;/home/alex/tensorflow/third_party/gpus/cuda_configure.bzl&quot;, line 1039
		_create_local_cuda_repository(repository_ctx)
	File &quot;/home/alex/tensorflow/third_party/gpus/cuda_configure.bzl&quot;, line 976, in _create_local_cuda_repository
		_host_compiler_includes(repository_ctx, cc)
	File &quot;/home/alex/tensorflow/third_party/gpus/cuda_configure.bzl&quot;, line 145, in _host_compiler_includes
		get_cxx_inc_directories(repository_ctx, cc)
	File &quot;/home/alex/tensorflow/third_party/gpus/cuda_configure.bzl&quot;, line 120, in get_cxx_inc_directories
		set(includes_cpp)
depsets cannot contain mutable items
INFO: Elapsed time: 13.663s
FAILED: Build did NOT complete successfully (0 packages loaded)
    currently loading: tensorflow/tools/pip_package"><pre class="notranslate"><code class="notranslate">Please specify the location of python. [Default is /usr/bin/python]: 
Found possible Python library paths:
/usr/local/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages
Please input the desired Python library path to use.  Default is /usr/local/lib/python2.7/dist-packages
Do you wish to build TensorFlow with jemalloc as malloc support? [Y/n]: 
jemalloc as malloc support will be enabled for TensorFlow.

Do you wish to build TensorFlow with Google Cloud Platform support? [y/N]: y
Google Cloud Platform support will be enabled for TensorFlow.

Do you wish to build TensorFlow with Hadoop File System support? [y/N]: 
No Hadoop File System support will be enabled for TensorFlow.

Do you wish to build TensorFlow with XLA JIT support? [y/N]: 
No XLA JIT support will be enabled for TensorFlow.

Do you wish to build TensorFlow with VERBS support? [y/N]: 
No VERBS support will be enabled for TensorFlow.

Do you wish to build TensorFlow with OpenCL support? [y/N]: y
OpenCL support will be enabled for TensorFlow.

Please specify which C++ compiler should be used as the host C++ compiler. [Default is /usr/bin/g++]: 
Please specify which C compiler should be used as the host C compiler. [Default is /usr/bin/gcc]: 
Please specify the location where ComputeCpp for SYCL 1.2 is installed. [Default is /usr/local/computecpp]: 
Do you wish to build TensorFlow with CUDA support? [y/N]: y
CUDA support will be enabled for TensorFlow.

Please specify the CUDA SDK version you want to use, e.g. 7.0. [Leave empty to default to CUDA 8.0]: 
Please specify the location where CUDA 8.0 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 default to cuDNN 6.0]: 
Please specify the location where cuDNN 6 library is installed. Refer to README.md for more details. [Default is /usr/local/cuda]:
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: 6.1]
Do you want to use clang as CUDA compiler? [y/N]: 
nvcc will be used as CUDA compiler.

Please specify which gcc should be used by nvcc as the host compiler. [Default is /usr/bin/gcc]: 
Do you wish to build TensorFlow with MPI support? [y/N]: 
No MPI support will be enabled for TensorFlow.

Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is -march=native]: 
Add "--config=mkl" to your bazel command to build with MKL support.
Please note that MKL on MacOS or windows is still not supported.
If you would like to use a local MKL instead of downloading, please set the environment variable "TF_MKL_ROOT" every time before build.
Configuration finished
...............
ERROR: Skipping '//tensorflow/tools/pip_package:build_pip_package': error loading package 'tensorflow/tools/pip_package': Encountered error while reading extension file 'cuda/build_defs.bzl': no such package '@local_config_cuda//cuda': Traceback (most recent call last):
	File "/home/alex/tensorflow/third_party/gpus/cuda_configure.bzl", line 1039
		_create_local_cuda_repository(repository_ctx)
	File "/home/alex/tensorflow/third_party/gpus/cuda_configure.bzl", line 976, in _create_local_cuda_repository
		_host_compiler_includes(repository_ctx, cc)
	File "/home/alex/tensorflow/third_party/gpus/cuda_configure.bzl", line 145, in _host_compiler_includes
		get_cxx_inc_directories(repository_ctx, cc)
	File "/home/alex/tensorflow/third_party/gpus/cuda_configure.bzl", line 120, in get_cxx_inc_directories
		set(includes_cpp)
depsets cannot contain mutable items
WARNING: Target pattern parsing failed.
ERROR: error loading package 'tensorflow/tools/pip_package': Encountered error while reading extension file 'cuda/build_defs.bzl': no such package '@local_config_cuda//cuda': Traceback (most recent call last):
	File "/home/alex/tensorflow/third_party/gpus/cuda_configure.bzl", line 1039
		_create_local_cuda_repository(repository_ctx)
	File "/home/alex/tensorflow/third_party/gpus/cuda_configure.bzl", line 976, in _create_local_cuda_repository
		_host_compiler_includes(repository_ctx, cc)
	File "/home/alex/tensorflow/third_party/gpus/cuda_configure.bzl", line 145, in _host_compiler_includes
		get_cxx_inc_directories(repository_ctx, cc)
	File "/home/alex/tensorflow/third_party/gpus/cuda_configure.bzl", line 120, in get_cxx_inc_directories
		set(includes_cpp)
depsets cannot contain mutable items
INFO: Elapsed time: 13.663s
FAILED: Build did NOT complete successfully (0 packages loaded)
    currently loading: tensorflow/tools/pip_package
</code></pre></div>