{"action":"created","issue":{"url":"https://api.github.com/repos/tensorflow/tensorflow/issues/10289","repository_url":"https://api.github.com/repos/tensorflow/tensorflow","labels_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/10289/labels{/name}","comments_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/10289/comments","events_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/10289/events","html_url":"https://github.com/tensorflow/tensorflow/issues/10289","id":232284139,"number":10289,"title":"Cannot bazel build tensorflow pip package from source (/usr/bin/env: 'python': No such file or directory)","user":{"login":"fferroni","id":16327442,"avatar_url":"https://avatars2.githubusercontent.com/u/16327442?v=3","gravatar_id":"","url":"https://api.github.com/users/fferroni","html_url":"https://github.com/fferroni","followers_url":"https://api.github.com/users/fferroni/followers","following_url":"https://api.github.com/users/fferroni/following{/other_user}","gists_url":"https://api.github.com/users/fferroni/gists{/gist_id}","starred_url":"https://api.github.com/users/fferroni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fferroni/subscriptions","organizations_url":"https://api.github.com/users/fferroni/orgs","repos_url":"https://api.github.com/users/fferroni/repos","events_url":"https://api.github.com/users/fferroni/events{/privacy}","received_events_url":"https://api.github.com/users/fferroni/received_events","type":"User","site_admin":false},"labels":[{"id":386191887,"url":"https://api.github.com/repos/tensorflow/tensorflow/labels/stat:awaiting%20response","name":"stat:awaiting response","color":"5319e7","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2017-05-30T15:04:57Z","updated_at":"2017-05-31T16:55:44Z","closed_at":null,"body":"------------------------\r\n### System information\r\n- OS Platform and Distribution: Linux Ubuntu 16.04\r\n- CUDA Toolkit v8.0\r\n- cuDNN 5\r\n- gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609\r\n- Bazel 0.5.0 (from repo)\r\n- Anaconda Python 3.6\r\n```\r\nfrancesco@gpu-box:~/tensorflow$ python\r\nPython 3.6.0 |Anaconda custom (64-bit)| (default, Dec 23 2016, 12:22:00) \r\n[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\r\n>>> \r\n```\r\n\r\n\r\n------------------------\r\n\r\nHello,\r\n\r\nI am trying to build tensor flow pip package from source. I can install and use tensorflow with GPU using a precompiled binary just fine. However, in this case, I need to build from source.\r\n\r\nHere is the following steps I take:\r\n1. git clone https://github.com/tensorflow/tensorflow.git\r\n2. cd tensorflow\r\n3. ./configure\r\n\r\n```\r\nfrancesco@gpu-box:~/tensorflow$ ./configure \r\nPlease specify the location of python. [Default is /home/francesco/anaconda3/bin/python]: \r\nFound possible Python library paths:\r\n  /home/francesco/anaconda3/lib/python3.6/site-packages/\r\n  /home/francesco/anaconda3/lib/python3.6/site-packages\r\nPlease input the desired Python library path to use.  Default is [/home/francesco/anaconda3/lib/python3.6/site-packages/]\r\n\r\nUsing python library path: /home/francesco/anaconda3/lib/python3.6/site-packages/\r\nDo you wish to build TensorFlow with MKL support? [y/N] n\r\nNo MKL support will be enabled for TensorFlow\r\nPlease specify optimization flags to use during compilation when bazel option \"--config=opt\" is specified [Default is -march=native]: \r\nDo you wish to use jemalloc as the malloc implementation? [Y/n] y\r\njemalloc enabled\r\nDo you wish to build TensorFlow with Google Cloud Platform support? [y/N] n\r\nNo Google Cloud Platform support will be enabled for TensorFlow\r\nDo you wish to build TensorFlow with Hadoop File System support? [y/N] n\r\nNo Hadoop File System support will be enabled for TensorFlow\r\nDo you wish to build TensorFlow with the XLA just-in-time compiler (experimental)? [y/N] n\r\nNo XLA JIT support will be enabled for TensorFlow\r\nDo you wish to build TensorFlow with VERBS support? [y/N] n\r\nNo VERBS support will be enabled for TensorFlow\r\nDo you wish to build TensorFlow with OpenCL support? [y/N] n\r\nNo OpenCL support will be enabled for TensorFlow\r\nDo you wish to build TensorFlow with CUDA support? [y/N] y\r\nCUDA support will be enabled for TensorFlow\r\nDo you want to use clang as CUDA compiler? [y/N] n\r\nnvcc will be used as CUDA compiler\r\nPlease specify the CUDA SDK version you want to use, e.g. 7.0. [Leave empty to use system default]: 8.0\r\nPlease specify the location where CUDA 8.0 toolkit is installed. Refer to README.md for more details. [Default is /usr/local/cuda]: \r\nPlease specify which gcc should be used by nvcc as the host compiler. [Default is /usr/bin/gcc]: \r\nPlease specify the cuDNN version you want to use. [Leave empty to use system default]: 5\r\nPlease specify the location where cuDNN 5 library is installed. Refer to README.md for more details. [Default is /usr/local/cuda]: \r\nPlease specify a list of comma-separated Cuda compute capabilities you want to build with.\r\nYou can find the compute capability of your device at: https://developer.nvidia.com/cuda-gpus.\r\nPlease note that each additional compute capability significantly increases your build time and binary size.\r\n[Default is: \"3.5,5.2\"]: 6.1\r\nDo you wish to build TensorFlow with MPI support? [y/N] n\r\nMPI support will not be enabled for TensorFlow\r\nINFO: Starting clean (this may take a while). Consider using --async if the clean takes more than several minutes.\r\nConfiguration finished\r\n\r\n```\r\n\r\nUnfortunately, when I then build with bazel, it runs into an error. It seems like it cannot find python?\r\n\r\n```\r\nfrancesco@gpu-box:~/tensorflow$ bazel build -c opt --verbose_failures --config=cuda //tensorflow/tools/pip_package:build_pip_package\r\nWARNING: /home/francesco/tensorflow/tensorflow/contrib/learn/BUILD:15:1: in py_library rule //tensorflow/contrib/learn:learn: target '//tensorflow/contrib/learn:learn' depends on deprecated target '//tensorflow/contrib/session_bundle:exporter': Use SavedModel Builder instead.\r\nWARNING: /home/francesco/tensorflow/tensorflow/contrib/learn/BUILD:15:1: in py_library rule //tensorflow/contrib/learn:learn: target '//tensorflow/contrib/learn:learn' depends on deprecated target '//tensorflow/contrib/session_bundle:gc': Use SavedModel instead.\r\nINFO: Found 1 target...\r\nINFO: From Compiling external/snappy/snappy-sinksource.cc [for host]:\r\ncc1plus: warning: command line option '-Wno-implicit-function-declaration' is valid for C/ObjC but not for C++\r\ncc1plus: warning: unrecognized command line option '-Wno-shift-negative-value'\r\nINFO: From Compiling external/snappy/snappy-c.cc [for host]:\r\ncc1plus: warning: command line option '-Wno-implicit-function-declaration' is valid for C/ObjC but not for C++\r\ncc1plus: warning: unrecognized command line option '-Wno-shift-negative-value'\r\nINFO: From Compiling external/snappy/snappy-stubs-internal.cc [for host]:\r\ncc1plus: warning: command line option '-Wno-implicit-function-declaration' is valid for C/ObjC but not for C++\r\ncc1plus: warning: unrecognized command line option '-Wno-shift-negative-value'\r\nINFO: From Compiling external/snappy/snappy.cc [for host]:\r\ncc1plus: warning: command line option '-Wno-implicit-function-declaration' is valid for C/ObjC but not for C++\r\nexternal/snappy/snappy.cc: In member function 'void snappy::SnappySinkAllocator::Flush(size_t)':\r\nexternal/snappy/snappy.cc:1403:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]\r\n     for (int i = 0; i < blocks_.size(); ++i) {\r\n                       ^\r\nIn file included from external/snappy/snappy-internal.h:34:0,\r\n                 from external/snappy/snappy.cc:30:\r\nexternal/snappy/snappy.cc: In instantiation of 'bool snappy::SnappyScatteredWriter<Allocator>::AppendFromSelf(size_t, size_t) [with Allocator = snappy::SnappySinkAllocator; size_t = long unsigned int]':\r\nexternal/snappy/snappy.cc:715:13:   required from 'void snappy::SnappyDecompressor::DecompressAllTags(Writer*) [with Writer = snappy::SnappyScatteredWriter<snappy::SnappySinkAllocator>]'\r\nexternal/snappy/snappy.cc:799:3:   required from 'bool snappy::InternalUncompressAllTags(snappy::SnappyDecompressor*, Writer*, snappy::uint32) [with Writer = snappy::SnappyScatteredWriter<snappy::SnappySinkAllocator>; snappy::uint32 = unsigned int]'\r\nexternal/snappy/snappy.cc:1460:78:   required from here\r\nexternal/snappy/snappy.cc:1316:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]\r\n     if (PREDICT_TRUE(offset - 1u < op_ptr_ - op_base_ && op_end <= op_limit_)) {\r\n                                  ^\r\nexternal/snappy/snappy-stubs-internal.h:80:25: note: in definition of macro 'PREDICT_TRUE'\r\n #define PREDICT_TRUE(x) x\r\n                         ^\r\nAt global scope:\r\ncc1plus: warning: unrecognized command line option '-Wno-shift-negative-value'\r\nERROR: /home/francesco/.cache/bazel/_bazel_francesco/7b3bdb053a374c3fec955b526c0e6446/external/highwayhash/BUILD.bazel:8:1: C++ compilation of rule '@highwayhash//:sip_hash' failed: crosstool_wrapper_driver_is_not_gcc failed: error executing command \r\n  (cd /home/francesco/.cache/bazel/_bazel_francesco/7b3bdb053a374c3fec955b526c0e6446/execroot/tensorflow && \\\r\n  exec env - \\\r\n    CUDA_TOOLKIT_PATH=/usr/local/cuda \\\r\n    CUDNN_INSTALL_PATH=/usr/local/cuda-8.0 \\\r\n    GCC_HOST_COMPILER_PATH=/usr/bin/gcc \\\r\n    PWD=/proc/self/cwd \\\r\n    PYTHON_BIN_PATH=/home/francesco/anaconda3/bin/python \\\r\n    PYTHON_LIB_PATH=/home/francesco/anaconda3/lib/python3.6/site-packages/ \\\r\n    TF_CUDA_CLANG=0 \\\r\n    TF_CUDA_COMPUTE_CAPABILITIES=6.1 \\\r\n    TF_CUDA_VERSION=8.0 \\\r\n    TF_CUDNN_VERSION=5 \\\r\n    TF_NEED_CUDA=1 \\\r\n    TF_NEED_OPENCL=0 \\\r\n  external/local_config_cuda/crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -fPIE -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 -DNDEBUG -ffunction-sections -fdata-sections '-std=c++11' -MD -MF bazel-out/local_linux-py3-opt/bin/external/highwayhash/_objs/sip_hash/external/highwayhash/highwayhash/sip_hash.pic.d '-frandom-seed=bazel-out/local_linux-py3-opt/bin/external/highwayhash/_objs/sip_hash/external/highwayhash/highwayhash/sip_hash.pic.o' -fPIC -iquote external/highwayhash -iquote bazel-out/local_linux-py3-opt/genfiles/external/highwayhash -iquote external/bazel_tools -iquote bazel-out/local_linux-py3-opt/genfiles/external/bazel_tools -isystem external/bazel_tools/tools/cpp/gcc3 -no-canonical-prefixes -Wno-builtin-macro-redefined '-D__DATE__=\"redacted\"' '-D__TIMESTAMP__=\"redacted\"' '-D__TIME__=\"redacted\"' -fno-canonical-system-headers -c external/highwayhash/highwayhash/sip_hash.cc -o bazel-out/local_linux-py3-opt/bin/external/highwayhash/_objs/sip_hash/external/highwayhash/highwayhash/sip_hash.pic.o): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 127.\r\n/usr/bin/env: 'python': No such file or directory\r\nTarget //tensorflow/tools/pip_package:build_pip_package failed to build\r\nINFO: Elapsed time: 44.289s, Critical Path: 5.54s\r\n```\r\n\r\nBoth my python_bin_path and python_lib_path are correct, so I do not understand.\r\n\r\nAny advice?\r\n\r\nRegards"},"comment":{"url":"https://api.github.com/repos/tensorflow/tensorflow/issues/comments/305249943","html_url":"https://github.com/tensorflow/tensorflow/issues/10289#issuecomment-305249943","issue_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/10289","id":305249943,"user":{"login":"fferroni","id":16327442,"avatar_url":"https://avatars2.githubusercontent.com/u/16327442?v=3","gravatar_id":"","url":"https://api.github.com/users/fferroni","html_url":"https://github.com/fferroni","followers_url":"https://api.github.com/users/fferroni/followers","following_url":"https://api.github.com/users/fferroni/following{/other_user}","gists_url":"https://api.github.com/users/fferroni/gists{/gist_id}","starred_url":"https://api.github.com/users/fferroni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fferroni/subscriptions","organizations_url":"https://api.github.com/users/fferroni/orgs","repos_url":"https://api.github.com/users/fferroni/repos","events_url":"https://api.github.com/users/fferroni/events{/privacy}","received_events_url":"https://api.github.com/users/fferroni/received_events","type":"User","site_admin":false},"created_at":"2017-05-31T16:55:44Z","updated_at":"2017-05-31T16:55:44Z","body":"Hi,\r\n\r\nThat worked!\r\n\r\n```\r\nAt global scope:\r\ncc1plus: warning: unrecognized command line option '-Wno-self-assign'\r\nTarget //tensorflow/tools/pip_package:build_pip_package up-to-date:\r\n  bazel-bin/tensorflow/tools/pip_package/build_pip_package\r\nINFO: Elapsed time: 1238.673s, Critical Path: 133.18s\r\n```\r\n\r\n However, I then build a wheel (still fine)\r\n\r\n```\r\nfrancesco@gpu-box:~/tensorflow$ bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg\r\nmer 31 mag 2017, 18.48.47, CEST : === Using tmpdir: /tmp/tmp.D9nGwyy56D\r\n~/tensorflow/bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles ~/tensorflow\r\n~/tensorflow\r\n/tmp/tmp.D9nGwyy56D ~/tensorflow\r\nmer 31 mag 2017, 18.48.48, CEST : === Building wheel\r\nwarning: no files found matching '*.dll' under directory '*'\r\nwarning: no files found matching '*.lib' under directory '*'\r\n~/tensorflow\r\nmer 31 mag 2017, 18.48.58, CEST : === Output wheel file is in: /tmp/tensorflow_pkg\r\n```\r\n\r\nI install the wheel tensorflow-1.2.0rc0-cp36-cp36m-linux_x86_64.whl\r\n\r\n```\r\nfrancesco@gpu-box:~/tensorflow$ pip install /tmp/tensorflow_pkg/tensorflow-1.2.0rc0-cp36-cp36m-linux_x86_64.whl\r\nProcessing /tmp/tensorflow_pkg/tensorflow-1.2.0rc0-cp36-cp36m-linux_x86_64.whl\r\nRequirement already satisfied: six>=1.10.0 in /home/francesco/anaconda3/lib/python3.6/site-packages (from tensorflow==1.2.0rc0)\r\nCollecting bleach==1.5.0 (from tensorflow==1.2.0rc0)\r\n  Using cached bleach-1.5.0-py2.py3-none-any.whl\r\nRequirement already satisfied: wheel>=0.26 in /home/francesco/anaconda3/lib/python3.6/site-packages (from tensorflow==1.2.0rc0)\r\nCollecting markdown==2.2.0 (from tensorflow==1.2.0rc0)\r\n  Downloading Markdown-2.2.0.tar.gz (236kB)\r\n    100% |████████████████████████████████| 245kB 1.8MB/s \r\nRequirement already satisfied: werkzeug>=0.11.10 in /home/francesco/anaconda3/lib/python3.6/site-packages (from tensorflow==1.2.0rc0)\r\nRequirement already satisfied: protobuf>=3.2.0 in /home/francesco/anaconda3/lib/python3.6/site-packages (from tensorflow==1.2.0rc0)\r\nRequirement already satisfied: numpy>=1.11.0 in /home/francesco/anaconda3/lib/python3.6/site-packages (from tensorflow==1.2.0rc0)\r\nCollecting html5lib==0.9999999 (from tensorflow==1.2.0rc0)\r\n  Using cached html5lib-0.9999999.tar.gz\r\nRequirement already satisfied: setuptools in /home/francesco/anaconda3/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg (from protobuf>=3.2.0->tensorflow==1.2.0rc0)\r\nBuilding wheels for collected packages: markdown, html5lib\r\n  Running setup.py bdist_wheel for markdown ... done\r\n  Stored in directory: /home/francesco/.cache/pip/wheels/b9/4f/6c/f4c1c5207c1d0eeaaf7005f7f736620c6ded6617c9d9b94096\r\n  Running setup.py bdist_wheel for html5lib ... done\r\n  Stored in directory: /home/francesco/.cache/pip/wheels/6f/85/6c/56b8e1292c6214c4eb73b9dda50f53e8e977bf65989373c962\r\nSuccessfully built markdown html5lib\r\nInstalling collected packages: html5lib, bleach, markdown, tensorflow\r\nSuccessfully installed bleach-1.5.0 html5lib-0.9999999 markdown-2.2.0 tensorflow-1.2.0rc0\r\n```\r\n\r\nbut when I try to import tensorflow, it fails :(\r\n\r\n```\r\nfrancesco@gpu-box:~/tensorflow$ python\r\nPython 3.6.0 |Anaconda custom (64-bit)| (default, Dec 23 2016, 12:22:00) \r\n[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\r\n>>> import tensorflow\r\nTraceback (most recent call last):\r\n  File \"/home/francesco/tensorflow/tensorflow/python/pywrap_tensorflow.py\", line 41, in <module>\r\n    from tensorflow.python.pywrap_tensorflow_internal import *\r\nModuleNotFoundError: No module named 'tensorflow.python.pywrap_tensorflow_internal'\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n  File \"<stdin>\", line 1, in <module>\r\n  File \"/home/francesco/tensorflow/tensorflow/__init__.py\", line 24, in <module>\r\n    from tensorflow.python import *\r\n  File \"/home/francesco/tensorflow/tensorflow/python/__init__.py\", line 49, in <module>\r\n    from tensorflow.python import pywrap_tensorflow\r\n  File \"/home/francesco/tensorflow/tensorflow/python/pywrap_tensorflow.py\", line 52, in <module>\r\n    raise ImportError(msg)\r\nImportError: Traceback (most recent call last):\r\n  File \"/home/francesco/tensorflow/tensorflow/python/pywrap_tensorflow.py\", line 41, in <module>\r\n    from tensorflow.python.pywrap_tensorflow_internal import *\r\nModuleNotFoundError: No module named 'tensorflow.python.pywrap_tensorflow_internal'\r\n\r\n\r\nFailed to load the native TensorFlow runtime.\r\n\r\nSee https://www.tensorflow.org/install/install_sources#common_installation_problems\r\n\r\nfor some common reasons and solutions.  Include the entire stack trace\r\nabove this error message when asking for help.\r\n```\r\n\r\nIs it an issue with the building process, or making the wheel, or installing the wheel?"}}
{"actor":{"display_login":"fferroni"}}