Run dev container docker run --gpus all -itd --name tf_cu101_build tensorflow/tensorflow:latest-devel-gpu-py3 Inside it Update deps apt update apt install cuda-nvprune-10-1 pip install -U numpy==1.19.2 pip six==1.15.0 Set env export TMP=/tmp export TF_NEED_TENSORRT=0 Update bazel cd "/usr/local/lib/bazel/bin" && curl -LO https://releases.bazel.build/3.7.2/release/bazel-3.7.2-linux-x86_64 && chmod +x bazel-3.7.2-linux-x86_64 Clone source cd ~ mkdir dist git clone https://github.com/tensorflow/tensorflow cd tensorflow/ git checkout r2.6 Configure it bazel clean ./configure Build bazel build --verbose_failures --config=cuda --config=mkl --config=avx_linux --config=avx2_linux --config=opt //tensorflow/tools/pip_package:build_pip_package Make pip package ./bazel-bin/tensorflow/tools/pip_package/build_pip_package /root/dist copy out the package to host from /root