Installation from Source Code
The process of building and installing TensorFlow 1.15.5 source code includes installing dependencies, obtaining source code, configuring related options, and building and installing the pip software package.
- Use PuTTY to log in to the server as the root user.
- Go to the compilation path for TensorFlow source code.
1cd /path/to/tensorflow
- Install the dependencies.
1 2 3 4 5 6
pip3 install wheel pip3 install Cython==0.29.14 pip3 install numpy==1.18.5 --no-build-isolation pip3 install h5py==2.8.0 pip3 install protobuf==3.19.0 pip3 install keras_preprocessing==1.1.2
- Configure the proxy for Git.
1 2 3
git config --global http.sslVerify false git config --global https.sslverify false git config --global http.proxy "http://Username:Password@Proxy_IP_address:Proxy_port"
- If the environment variable configuration has been loaded, skip this step. Set the Bazel and Python environment variables based on the actual installation path. Example:
1 2 3
export PATH=/path/to/bazel/bazel-0.26.1/output:$PATH export PATH=/usr/local/python3.7.5/bin:$PATH export LD_LIBRARY_PATH=/usr/local/python3.7.5/lib:$LD_LIBRARY_PATH
- Obtain the TensorFlow 1.15.5 source code.
1wget https://github.com/tensorflow/tensorflow/archive/refs/tags/v1.15.5.zip --no-check-certificate
- Decompress the TensorFlow source package and go to the decompressed directory.
1 2
unzip v1.15.5.zip cd tensorflow-1.15.5
- Run configure to set the configuration options.
1./configure
The configuration procedure is as follows:
- Confirm the location of the Python executable program.
1Please specify the location of python. [Default is /usr/bin/python]:
If the Python 3 path is the same as the preceding default path, press Enter. Otherwise, enter the correct Python 3 path.
- Confirm the location of the Python library.
1 2 3
Found possible Python library paths: /usr/local/python3.7.5/lib/python3.7/site-packages Please input the desired Python library path to use. Default is [/usr/local/python3.7.5/lib/python3.7/site-packages]
If the Python 3 path is the same as the preceding default path, press Enter. Otherwise, enter the correct Python library path.
- Determine whether to enable the XLA JIT feature. In this document, enter n.
1Do you wish to build TensorFlow with XLA JIT support? [Y/n]:n
- Determine whether to enable the OpenCL SYCL feature. In this document, enter N.
1Do you wish to build TensorFlow with OpenCL SYCL support? [y/N]: N
- Determine whether to enable the ROCm feature. In this document, enter N.
1Do you wish to build TensorFlow with ROCm support? [y/N]: N
- Determine whether to enable the CUDA feature. In this document, enter N.
1Do you wish to build TensorFlow with CUDA support? [y/N]: N
- Determine whether to enable Clang. In this document, enter N.
1Do you wish to download a fresh release of clang? (Experimental) [y/N]: N
- Determine whether to enable MPI. In this document, enter N.
1Do you wish to build TensorFlow with MPI support? [y/N]: N
- Configure compilation options. In this document, retain the default settings and press Enter.
1Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is -Wno-sign-compare]:
- When building an Android application, determine whether to set a workspace. In this document, enter N.
1"Would you like to interactively configure ./WORKSPACE for Android builds? [y/N]: N
- Confirm the location of the Python executable program.
- Build TensorFlow.
1bazel build --config=v1 --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0" //tensorflow/tools/pip_package:build_pip_package
- Building TensorFlow from source code requires substantial memory. For memory-constrained systems, add the --local_ram_resources={memory_size} option to the build command. For example, --local_ram_resources=2048 indicates that the maximum memory overhead allowed is 2048 MB.
- During the compilation process, a certificate verification error may be reported stating "unable to find valid certification path to requested target." Rectify this error by following instructions in Failed to Verify the Certificate When Compiling TensorFlow 1.15.5.
- During the compilation process, an hwloc compilation error may be reported stating "external/hwloc/hwloc/topology.c:45:10: fatal error: sys/sysctl.h: No such file or directory." Rectify this error by following instructions in Failed to Compile the hwloc Dependency When Compiling TensorFlow 1.15.5.
- During the compilation process, a gRPC compilation error may be reported stating "external/grpc/src/core/lib/gpr/log_linux.cc:43:13: error: ambiguating new declaration of 'long int gettid()'." Rectify this error by following instructions in Failed to Compile the gRPC Dependency When Compiling TensorFlow 1.15.5.
- Build the pip software package.
1./bazel-bin/tensorflow/tools/pip_package/build_pip_package ./outputThe tensorflow-1.15.5-cp37-cp37m-linux_aarch64.whl software package is generated in the output directory.
- Install the TensorFlow pip software package.
1 2
cd output pip3 install tensorflow-1.15.5-cp37-cp37m-linux_aarch64.whl
Parent topic: Porting Guide (TensorFlow 1.15.5)