This is going to be a tutorial on how to install tensorflow 1.7.0 GPU version. We will also be installing CUDA Toolkit 9.1 and cuDNN 7.1.2 along with the GPU version of tensorflow 1.7.0. At the time of writing this blog post, the latest version of tensorflow is 1.7.0.This tutorial is for building tensorflow from source. If you want to use the official pre-built pip package instead, I recommend another post, How to install Tensorflow 1.7.0 using official pip package.
Tensorflow is an open source software library developed and used by Google that is fairly common among students, researchers, and developers for deep learning applications such as neural networks. It has both the CPU as well as GPU version available and although the CPU version works quite well, realistically, if you are going for deep learning, you will need GPU. In order to use the GPU version of TensorFlow, you will need an NVIDIA GPU with a compute capability > 3.0. While it is technically possible to install tensorflow GPU version in a virtual machine, you cannot access the full power of your GPU via a virtual machine. So, I recommend doing a fresh install of Ubuntu if you don’t have Ubuntu before starting with the tutorial.
There must be 64-bit python installed tensorflow does not work on 32-bit python installation.
Step 1: Update and Upgrade your system:
sudo apt-get update sudo apt-get upgrade
Step 2: Verify You Have a CUDA-Capable GPU:
lspci | grep -i nvidia
Note GPU model. eg. GeForce 840M
If you do not see any settings, update the PCI hardware database that Linux maintains by entering update-pciids (generally found in /sbin) at the command line and rerun the previous lspci command.
If your graphics card is from NVIDIA then goto http://developer.nvidia.com/cuda-gpus and verify if listed in CUDA enabled gpu list.
Note down its Compute Capability. eg. GeForce 840M 5.0
Step 3: Verify You Have a Supported Version of Linux:
To determine which distribution and release number you’re running, type the following at the command line:
uname -m && cat /etc/*release
The x86_64 line indicates you are running on a 64-bit system which is supported by cuda 9.1
Step 4: Install Dependencies:
Required to compile from source:
sudo apt-get install build-essential sudo apt-get install cmake git unzip zip sudo apt-get install python2.7-dev python3.5-dev python3.6-dev pylint
Step 5: Install linux kernel header:
Goto terminal and type:
uname -r
You can get like “4.10.0-42-generic”. Note down linux kernel version.
To install linux header supported by your linux kernel do following:
sudo apt-get install linux-headers-$(uname -r)
Step 6: Download the NVIDIA CUDA Toolkit:
Go to https://developer.nvidia.com/cuda-downloads and download Installer for Linux Ubuntu 16.04 x86_64 deb[network]. I highly recommend network installer to get updated gpu driver supported by your linux kernel.
For, direct download
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_9.1.85-1_amd64.deb
Installation Instructions:
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub sudo dpkg -i cuda-repo-ubuntu1604_9.1.85-1_amd64.deb sudo apt-get update sudo apt-get install cuda-9.1
hi thanks for sharing really help a lot. however still i met with a problem :
when step 12
bazel build –config=opt –config=cuda –incompatible_load_argument_is_label=false //tensorflow/tools/pip_package:build_pip_package
———————————————————————
At global scope:
cc1plus: warning: unrecognized command line option ‘-Wno-shift-negative-value’
ERROR: /home/sishuo/.cache/bazel/_bazel_sishuo/331bb7d0079dded51fc30dfe575a62ce/external/farmhash_archive/BUILD:19:1: C++ compilation of rule ‘@farmhash_archive//:farmhash’ failed (Exit 1)
gcc: error: =: No such file or directory
gcc: error: native: No such file or directory
gcc: error: unrecognized command line option ‘-march’
Target //tensorflow/tools/pip_package:build_pip_package failed to build
Use –verbose_failures to see the command lines of failed build steps.
anyone face similar prob?
Use verbose_failures and post the error. What version you are using for tensorflow, gcc and bazel ?
tensorflow v1.5
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.6) 5.4.0 20160609
[bazel release 0.9.0]
WARNING: /home/sishuo/Downloads/tensorflow-1.5.0/tensorflow/core/BUILD:1814:1: in includes attribute of cc_library rule //tensorflow/core:framework_headers_lib: ‘../../external/nsync/public’ resolves to ‘external/nsync/public’ not below the relative path of its package ‘tensorflow/core’. This will be an error in the future. Since this rule was created by the macro ‘cc_header_only_library’, the error might have been caused by the macro implementation in /home/sishuo/Downloads/tensorflow-1.5.0/tensorflow/tensorflow.bzl:1138:30
WARNING: /home/sishuo/Downloads/tensorflow-1.5.0/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’: No longer supported. Switch to SavedModel immediately.
WARNING: /home/sishuo/Downloads/tensorflow-1.5.0/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’: No longer supported. Switch to SavedModel immediately.
INFO: Analysed target //tensorflow/tools/pip_package:build_pip_package (0 packages loaded).
INFO: Found 1 target…
ERROR: /home/sishuo/.cache/bazel/_bazel_sishuo/331bb7d0079dded51fc30dfe575a62ce/external/flatbuffers/BUILD:16:1: C++ compilation of rule ‘@flatbuffers//:flatbuffers’ failed (Exit 1): crosstool_wrapper_driver_is_not_gcc failed: error executing command
(cd /home/sishuo/.cache/bazel/_bazel_sishuo/331bb7d0079dded51fc30dfe575a62ce/execroot/org_tensorflow && \
exec env – \
CUDA_TOOLKIT_PATH=/usr/local/cuda \
CUDNN_INSTALL_PATH=/usr/lib/x86_64-linux-gnu \
GCC_HOST_COMPILER_PATH=/usr/bin/gcc \
PWD=/proc/self/cwd \
PYTHON_BIN_PATH=/usr/bin/python3 \
PYTHON_LIB_PATH=/usr/local/lib/python3.5/dist-packages \
TF_CUDA_CLANG=0 \
TF_CUDA_COMPUTE_CAPABILITIES=6.1 \
TF_CUDA_VERSION=9.1 \
TF_CUDNN_VERSION=7.0.5 \
TF_NEED_CUDA=1 \
TF_NEED_OPENCL_SYCL=0 \
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 -DGEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK -march ‘=’ native ‘-std=c++11’ -MD -MF bazel-out/k8-py3-opt/bin/external/flatbuffers/_objs/flatbuffers/external/flatbuffers/src/reflection.d ‘-frandom-seed=bazel-out/k8-py3-opt/bin/external/flatbuffers/_objs/flatbuffers/external/flatbuffers/src/reflection.o’ -iquote external/flatbuffers -iquote bazel-out/k8-py3-opt/genfiles/external/flatbuffers -iquote external/bazel_tools -iquote bazel-out/k8-py3-opt/genfiles/external/bazel_tools -isystem external/flatbuffers/include -isystem bazel-out/k8-py3-opt/genfiles/external/flatbuffers/include -isystem external/bazel_tools/tools/cpp/gcc3 -fexceptions -Wno-implicit-fallthrough -no-canonical-prefixes -Wno-builtin-macro-redefined ‘-D__DATE__=”redacted”‘ ‘-D__TIMESTAMP__=”redacted”‘ ‘-D__TIME__=”redacted”‘ -fno-canonical-system-headers -c external/flatbuffers/src/reflection.cpp -o bazel-out/k8-py3-opt/bin/external/flatbuffers/_objs/flatbuffers/external/flatbuffers/src/reflection.o)
gcc: error: =: No such file or directory
gcc: error: native: No such file or directory
gcc: error: unrecognized command line option ‘-march’
Target //tensorflow/tools/pip_package:build_pip_package failed to build
use
bazel clean --expung
thenbazel shutdown
and start again from./configure
if not worked then remove bazel from cache using following commandrm -rf ~/.cache/bazel
then try again.^
ERROR: /home/sishuo/Downloads/tensorflow-1.5.0/tensorflow/python/BUILD:4585:1: C++ compilation of rule ‘//tensorflow/python:framework/fast_tensor_util.so’ failed (Exit 1): crosstool_wrapper_driver_is_not_gcc failed: error executing command
(cd /home/sishuo/.cache/bazel/_bazel_sishuo/331bb7d0079dded51fc30dfe575a62ce/execroot/org_tensorflow && \
exec env – \
CUDA_TOOLKIT_PATH=/usr/local/cuda \
CUDNN_INSTALL_PATH=/usr/lib/x86_64-linux-gnu \
GCC_HOST_COMPILER_PATH=/usr/bin/gcc \
PWD=/proc/self/cwd \
PYTHON_BIN_PATH=/usr/bin/python3 \
PYTHON_LIB_PATH=/usr/local/lib/python3.5/dist-packages \
TF_CUDA_CLANG=0 \
TF_CUDA_COMPUTE_CAPABILITIES=6.1 \
TF_CUDA_VERSION=9.1 \
TF_CUDNN_VERSION=7.0.5 \
TF_NEED_CUDA=1 \
TF_NEED_OPENCL_SYCL=0 \
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 -DGEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK -march ‘=’ native ‘-std=c++11’ -MD -MF bazel-out/k8-py3-opt/bin/tensorflow/python/_objs/framework/fast_tensor_util.so/tensorflow/python/framework/fast_tensor_util.pic.d ‘-frandom-seed=bazel-out/k8-py3-opt/bin/tensorflow/python/_objs/framework/fast_tensor_util.so/tensorflow/python/framework/fast_tensor_util.pic.o’ -fPIC -iquote . -iquote bazel-out/k8-py3-opt/genfiles -iquote external/local_config_python -iquote bazel-out/k8-py3-opt/genfiles/external/local_config_python -iquote external/bazel_tools -iquote bazel-out/k8-py3-opt/genfiles/external/bazel_tools -isystem external/local_config_python/numpy_include -isystem bazel-out/k8-py3-opt/genfiles/external/local_config_python/numpy_include -isystem external/bazel_tools/tools/cpp/gcc3 -isystem external/local_config_python/python_include -isystem bazel-out/k8-py3-opt/genfiles/external/local_config_python/python_include -no-canonical-prefixes -Wno-builtin-macro-redefined ‘-D__DATE__=”redacted”‘ ‘-D__TIMESTAMP__=”redacted”‘ ‘-D__TIME__=”redacted”‘ -fno-canonical-system-headers -c bazel-out/k8-py3-opt/genfiles/tensorflow/python/framework/fast_tensor_util.cpp -o bazel-out/k8-py3-opt/bin/tensorflow/python/_objs/framework/fast_tensor_util.so/tensorflow/python/framework/fast_tensor_util.pic.o)
gcc: error: =: No such file or directory
gcc: error: native: No such file or directory
gcc: error: unrecognized command line option ‘-march’
Target //tensorflow/tools/pip_package:build_pip_package failed to build
INFO: Elapsed time: 198.452s, Critical Path: 19.14s
FAILED: Build did NOT complete successfully
above is error message rebuild after including –verbose_failures
Try to build cpu version and did you clean bazel cache as written in previous reply ?
yes previous reply is after bazel clean and shutdown.
i tried again with
bazel clean –expunge
bazel shutdown
then re configure following step 11
then use cpu-ver build comment adding –config=mkl –verbose_failures as below
bazel build –config=opt –incompatible_load_argument_is_label=false –config=mkl –verbose_failures //tensorflow/tools/pip_package:build_pip_package
below is full message returned:
INFO: From ProtoCompile tensorflow/core/example/example.pb.cc:
bazel-out/k8-py3-opt/genfiles/external/protobuf_archive/src: warning: directory does not exist.
ERROR: /home/sishuo/Downloads/tensorflow-1.5.0/tensorflow/python/BUILD:1439:1: Linking of rule '//tensorflow/python:gen_spectral_ops_py_wrappers_cc' failed (Exit 1): crosstool_wrapper_driver_is_not_gcc failed: error executing command
(cd /home/sishuo/.cache/bazel/_bazel_sishuo/331bb7d0079dded51fc30dfe575a62ce/execroot/org_tensorflow && \
exec env – \
LD_LIBRARY_PATH=/usr/local/cuda/extras/CUPTI/lib64:/usr/local/cuda/extras/CUPTI/lib64:/usr/local/cuda-9.1/lib64:/usr/local/cuda/extras/CUPTI/lib64:/usr/local/cuda/extras/CUPTI/lib64:/usr/local/cuda-9.1/lib64 \
PATH=/usr/local/cuda-9.1/bin:/usr/local/cuda-9.1/bin:/home/sishuo/bin:/home/sishuo/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin \
PWD=/proc/self/cwd \
external/local_config_cuda/crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc -o bazel-out/host/bin/tensorflow/python/gen_spectral_ops_py_wrappers_cc '-Wl,-rpath,$ORIGIN/../../_solib_local/_U_S_Stensorflow_Spython_Cgen_Uspectral_Uops_Upy_Uwrappers_Ucc___Utensorflow' '-Wl,-rpath,$ORIGIN/../../_solib_local/[email protected]_Uconfig_Ucuda_S_Scuda_Ccudart___Uexternal_Slocal_Uconfig_Ucuda_Scuda_Scuda_Slib' '-Wl,-rpath,$ORIGIN/../../_solib_local/_U_S_Sthird_Uparty_Smkl_Cintel_Ubinary_Ublob___Uexternal_Smkl_Slib' -Lbazel-out/host/bin/_solib_local/_U_S_Stensorflow_Spython_Cgen_Uspectral_Uops_Upy_Uwrappers_Ucc___Utensorflow -Lbazel-out/host/bin/_solib_local/[email protected]_Uconfig_Ucuda_S_Scuda_Ccudart___Uexternal_Slocal_Uconfig_Ucuda_Scuda_Scuda_Slib -Lbazel-out/host/bin/_solib_local/_U_S_Sthird_Uparty_Smkl_Cintel_Ubinary_Ublob___Uexternal_Smkl_Slib '-Wl,-rpath,$ORIGIN/,-rpath,$ORIGIN/..' -Wl,-rpath,../local_config_cuda/cuda/lib64 -Wl,-rpath,../local_config_cuda/cuda/extras/CUPTI/lib64 -pthread -Wl,-no-as-needed -B/usr/bin/ -pie -Wl,-z,relro,-z,now -no-canonical-prefixes -pass-exit-codes '-Wl,–build-id=md5' '-Wl,–hash-style=gnu' -Wl,–gc-sections -Wl,-S -Wl,@bazel-out/host/bin/tensorflow/python/gen_spectral_ops_py_wrappers_cc-2.params)
/usr/bin/ld: warning: libnvidia-fatbinaryloader.so.387.26, needed by //usr/lib/x86_64-linux-gnu/libcuda.so.1, not found (try using -rpath or -rpath-link)
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `elf64_shnum'
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `elfLink_Get_FatBinary_From_Object'
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `elfLink_Add_Cubin'
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `elf64_section_contents'
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `elf32_section_header'
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `gpuInfoRunsOn'
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `elf64_section_header'
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `elf_end'
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `elf32_named_section_header'
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `elf32_shnum'
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `elfLink_Delete'
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `elfLink_Finish_Reading_Library'
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `fatBinaryCtl'
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `elf64_symbol_shndx'
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `elf64_typed_section_header'
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `gpucompRestoreLogLine'
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `elf64_file_header'
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `elfLink_Free_Fatbinary'
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `elf32_string_at_offset'
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `elf32_symbol_shndx'
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `fatBinaryCtl_Compile'
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `fatBinaryCtl_PickCandidate'
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `elf32_file_header'
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `elf64_string_at_offset'
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `elfLink_Load_Host_Object'
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `elfLink_Start'
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `elfLink_Start_Reading_Library'
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `elf32_typed_section_header'
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `elfLink_Next_Library_Member'
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `gpucompSetLogLine'
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `elfLink_Finish'
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `elf64_section_name'
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `elf_is_64bit'
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `elfLink_Free_Host_Object'
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `elf64_named_section_header'
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `elf_size'
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `elf32_symbol_name'
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `elf32_section_name'
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `fatBinaryCtl_Delete'
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `fatBinaryCtl_Create'
//usr/lib/x86_64-linux-gnu/libcuda.so.1: undefined reference to `elf64_symbol_name'
collect2: error: ld returned 1 exit status
Target //tensorflow/tools/pip_package:build_pip_package failed to build
INFO: Elapsed time: 320.575s, Critical Path: 28.90s
FAILED: Build did NOT complete successfully
While configuring don’t enable cuda for cpu version and do not use mkl. This is for test build.
ah just re install and success
thank you.
i think probally i may miss some steps.
anyway it is solved now. thank you!
hey! thanks for the tut.
I’m having this error trying to building Tensorflow using bazel:
cmd :
bazel build –config=opt –config=cuda –incompatible_load_argument_is_label=false //tensorflow/tools/pip_package:build_pip_package
error:
Traceback (most recent call last):
File “”, line 1, in
ModuleNotFoundError: No module named ‘numpy’
Is numpy installed?
and referenced by ‘//util/python:python_headers’
ERROR: Analysis of target ‘//tensorflow/tools/pip_package:build_pip_package’ failed; build aborted: Loading failed
INFO: Elapsed time: 1.559s
FAILED: Build did NOT complete successfully (28 packages loaded)
currently loading: tensorflow/core … (3 packages)
but I already have Numpy installed…
Can you help me please?
Thanks
This tutorial is tested on tensorflow 1.5.0 and please make sure the python defined while running ./configure has numpy installed. You can also give the path of python from a virtual environment which have numpy already installed.
I got the following error when I issued:
“bazel build –config=opt –config=cuda –incompatible_load_argument_is_label=false //tensorflow/tools/pip_package:build_pip_package” command:
ERROR: /home/krish-thorcode/My_files/tensorflow/tensorflow-1.4.1/WORKSPACE:15:1: Traceback (most recent call last):
File “/home/krish-thorcode/My_files/tensorflow/tensorflow-1.4.1/WORKSPACE”, line 15
closure_repositories()
File “/home/krish-thorcode/.cache/bazel/_bazel_krish-thorcode/193a33ded3e9f93a1e2171a9a3a9a41d/external/io_bazel_rules_closure/closure/repositories.bzl”, line 69, in closure_repositories
_check_bazel_version(“Closure Rules”, “0.4.5”)
File “/home/krish-thorcode/.cache/bazel/_bazel_krish-thorcode/193a33ded3e9f93a1e2171a9a3a9a41d/external/io_bazel_rules_closure/closure/repositories.bzl”, line 172, in _check_bazel_version
fail((“%s requires Bazel >=%s but was…)))
Closure Rules requires Bazel >=0.4.5 but was 0.10.0
Hello, now updated. Do following before ./configure
sudo apt-get remove bazel
sudo rm /etc/apt/sources.list.d/bazel.list
sudo apt-get autoremove
wget https://github.com/bazelbuild/bazel/releases/download/0.9.0/bazel_0.9.0-linux-x86_64.deb
sudo dpkg -i bazel_0.9.0-linux-x86_64.deb
+1
Compiling TF 1.5.0 from source is extermely differnet than 1.4.1
it does not download MKL if you need it so you need to give it the MKL_ROOT folder
it forces for some odd reason Andriod SDK to be exist for compilig
ERROR: /tensorflow/tensorflow/contrib/lite/kernels/internal/BUILD:331:1: no such package ‘@androidndk//’: The repository could not be resolved and referenced by ‘//tensorflow/contrib/lite/kernels/internal:cpu_check’.
Hello, according to this file third_party/mkl/build_defs.bzl will download mkl files from internet if not defined locally, i have not tried mkl. Are you trying to build Tensorflow lite ?
Compilation was failing with a library moan. I had to do this to make it work:
bazel build –config=opt –config=cuda tensorflow/tools/pip_package:build_pip_package –action_env=”LD_LIBRARY_PATH=${LD_LIBRARY_PATH}”
from:
https://stackoverflow.com/questions/47080760/tensorflow-fails-to-compile/47295278#47295278
Thanks for sharing. It will be useful to others to in case of build error related to so file reference. Did you define LD_LIBRARY_PATH in bashrc as mentioned in step 8 ?
Hi. when in Step12 after “bazel build –config=opt –config=cuda –incompatible_load_argument_is_label=false //tensorflow/tools/pip_package:build_pip_package” I got 2 Errors:
a)ERROR: /home/stacey/tensorflow-1.4.1/tensorflow/contrib/s3/BUILD:69:1: no such package ‘@aws//’: java.io.IOException: thread interrupted and referenced by ‘//tensorflow/contrib/s3:s3_file_system’
b)ERROR: Analysis of target ‘//tensorflow/tools/pip_package:build_pip_package’ failed; build aborted: no such package ‘@aws//’: java.io.IOException: thread interrupted
I’m new in this platform and have no idea with that, could anyone help? Thanks a lot!
What is your build platform and OS ? Please make sure patch is installed. If not installed then installed from apt (or yum). Then do this before ./configure “bazel clean –expunge” and then “bazel shutdown”.
Wow! Thanks for your quick reply! I followed your suggestions and now I saw “Hello, Tensorflow!” 😀
If you want to install with tensorflow 1.5 should we be using
https://github.com/tensorflow/tensorflow/archive/v1.5.0-rc1.zip
or
https://github.com/tensorflow/tensorflow/archive/v1.5.0.zip
Both will work. 1.5.0 is final so it may have some improvement.
Hello. WOnderful post. I’m unable to build tensorflow due to my gcc version being above 6. How do I fix this?
Hello, sudo apt-get install build-essential should install gcc 5.4 on ubuntu 16.04. Then you can create symbolic link for gcc5.4 to gcc in /usr/bin using
ln -s /usr/bin/g++-6 /usr/bin/g++
ln -s /usr/bin/gcc-6 /usr/bin/gcc
Thank you for taking the time to create this. It (so far) has been very helpful. I have been struggling for days to get everything to work, despite following all the appropriate guides and all the install manuals. It seems like I tried to install when all the release cycles didn’t correspond.
My question is: If I wanted to uninstall this in the future, how would I go about doing that? Would it be as simple as pip uninstall tensorflow?
Hi Andrew. By going through tutorial you have installed cuda 9.1 and latest nvidia gpu driver and built tensorflow-gpu whl file. To uninstall tensorflow only not cuda 9.1 then pip uninstall works. But if you want to install official prebuilt whl file then you need cuda 9.0. In that case you have to uninstall cuda 9.1 too and then install cuda 9.0.
Thanks for the quick reply Arun.
Arun,
This article is incredibly detailed and obviously took a lot of time to put together. Thanks for the effort.
I’m attempting to follow your instructions, but am utterly baffled by what I’m supposed to do in Step 5. The ‘uname -r’ command on my machine returns 4.13.0-1007-gcp.
As suggested, I ran the remove command and rebooted my machine (a Google Cloud VM). Now the machine is effectively dead (no surprise here). I can delete and recreate the VM, but I still don’t know how to correctly remove and install the correct version of the kernel.
Tx.
Joe
Hi Joe. I think you have only linux kernel 4.13 installed and removing it makes ubuntu unbootable. I have updated the tutorial. May be latest nvidia driver works on latest kernel. But only use cuda toolkit deb network installer to get latest nvidia driver. If it not worked then you can install linux image 4.10 and its headers first before removing 4.13.