CUDA/Cudnn/Driver/GCC/TensorFlow/Python version compatibility charts

CUDA/Cudnn/Driver/GCC/TensorFlow/Python version compatibility charts

Running (training) legacy machine learning models, especially models written for TensorFlow v1, is not a trivial task mostly due to the version incompatibility issue. This post will show the compatibility table with references to official pages.

The general flow of compatibility resolving process is

  • TensorFlow → Python
  • TensorFlow → Cudnn/Cuda → NVIDIA driver/GCC

For example: to use TensorFlow version 1, you need to install the following specific versions:

  • tensorflow==1.15 (latest v1).
  • tensorflow-gpu==1.15
  • Python 3.7 (the latest version supported by TF 1.15).
  • CUDA 10.0 (required by TF 1.15). Note: install a different minor version CUDA 10.2 does not work.
  • NVIDIA driver 410.48 (comes with CUDA 10.0 Toolkit) or NVIDIA 470 (I installed via apt and confirmed that it works).
  • Cudnn 7.4 (required by TF 1.15).
  • tensorflow-probability==0.7 (my project's need).
  • tensorflow-datasets==3.2.1 (my project's need).

Let's solve these compatibility requirements one by one.

TensorFlow compatibility

Official page with the compatibility chart

Linux

CPU (Linux)

VersionPython versionCompilerBuild tools
tensorflow-2.9.03.7-3.10GCC 9.3.1Bazel 5.0.0
tensorflow-2.8.03.7-3.10GCC 7.3.1Bazel 4.2.1
tensorflow-2.7.03.7-3.9GCC 7.3.1Bazel 3.7.2
tensorflow-2.6.03.6-3.9GCC 7.3.1Bazel 3.7.2
tensorflow-2.5.03.6-3.9GCC 7.3.1Bazel 3.7.2
tensorflow-2.4.03.6-3.8GCC 7.3.1Bazel 3.1.0
tensorflow-2.3.03.5-3.8GCC 7.3.1Bazel 3.1.0
tensorflow-2.2.03.5-3.8GCC 7.3.1Bazel 2.0.0
tensorflow-2.1.02.7, 3.5-3.7GCC 7.3.1Bazel 0.27.1
tensorflow-2.0.02.7, 3.3-3.7GCC 7.3.1Bazel 0.26.1
tensorflow-1.15.02.7, 3.3-3.7GCC 7.3.1Bazel 0.26.1
tensorflow-1.14.02.7, 3.3-3.7GCC 4.8Bazel 0.24.1
tensorflow-1.13.12.7, 3.3-3.7GCC 4.8Bazel 0.19.2
tensorflow-1.12.02.7, 3.3-3.6GCC 4.8Bazel 0.15.0
tensorflow-1.11.02.7, 3.3-3.6GCC 4.8Bazel 0.15.0
tensorflow-1.10.02.7, 3.3-3.6GCC 4.8Bazel 0.15.0
tensorflow-1.9.02.7, 3.3-3.6GCC 4.8Bazel 0.11.0
tensorflow-1.8.02.7, 3.3-3.6GCC 4.8Bazel 0.10.0
tensorflow-1.7.02.7, 3.3-3.6GCC 4.8Bazel 0.10.0
tensorflow-1.6.02.7, 3.3-3.6GCC 4.8Bazel 0.9.0
tensorflow-1.5.02.7, 3.3-3.6GCC 4.8Bazel 0.8.0
tensorflow-1.4.02.7, 3.3-3.6GCC 4.8Bazel 0.5.4
tensorflow-1.3.02.7, 3.3-3.6GCC 4.8Bazel 0.4.5
tensorflow-1.2.02.7, 3.3-3.6GCC 4.8Bazel 0.4.5
tensorflow-1.1.02.7, 3.3-3.6GCC 4.8Bazel 0.4.2
tensorflow-1.0.02.7, 3.3-3.6GCC 4.8Bazel 0.4.2

GPU (Linux)

VersionPython versionCompilerBuild toolscuDNNCUDA
tensorflow-2.9.03.7-3.10GCC 9.3.1Bazel 5.0.08.111.2
tensorflow-2.8.03.7-3.10GCC 7.3.1Bazel 4.2.18.111.2
tensorflow-2.7.03.7-3.9GCC 7.3.1Bazel 3.7.28.111.2
tensorflow-2.6.03.6-3.9GCC 7.3.1Bazel 3.7.28.111.2
tensorflow-2.5.03.6-3.9GCC 7.3.1Bazel 3.7.28.111.2
tensorflow-2.4.03.6-3.8GCC 7.3.1Bazel 3.1.08.011.0
tensorflow-2.3.03.5-3.8GCC 7.3.1Bazel 3.1.07.610.1
tensorflow-2.2.03.5-3.8GCC 7.3.1Bazel 2.0.07.610.1
tensorflow-2.1.02.7, 3.5-3.7GCC 7.3.1Bazel 0.27.17.610.1
tensorflow-2.0.02.7, 3.3-3.7GCC 7.3.1Bazel 0.26.17.410.0
tensorflow_gpu-1.15.02.7, 3.3-3.7GCC 7.3.1Bazel 0.26.17.410.0
tensorflow_gpu-1.14.02.7, 3.3-3.7GCC 4.8Bazel 0.24.17.410.0
tensorflow_gpu-1.13.12.7, 3.3-3.7GCC 4.8Bazel 0.19.27.410.0
tensorflow_gpu-1.12.02.7, 3.3-3.6GCC 4.8Bazel 0.15.079
tensorflow_gpu-1.11.02.7, 3.3-3.6GCC 4.8Bazel 0.15.079
tensorflow_gpu-1.10.02.7, 3.3-3.6GCC 4.8Bazel 0.15.079
tensorflow_gpu-1.9.02.7, 3.3-3.6GCC 4.8Bazel 0.11.079
tensorflow_gpu-1.8.02.7, 3.3-3.6GCC 4.8Bazel 0.10.079
tensorflow_gpu-1.7.02.7, 3.3-3.6GCC 4.8Bazel 0.9.079
tensorflow_gpu-1.6.02.7, 3.3-3.6GCC 4.8Bazel 0.9.079
tensorflow_gpu-1.5.02.7, 3.3-3.6GCC 4.8Bazel 0.8.079
tensorflow_gpu-1.4.02.7, 3.3-3.6GCC 4.8Bazel 0.5.468
tensorflow_gpu-1.3.02.7, 3.3-3.6GCC 4.8Bazel 0.4.568
tensorflow_gpu-1.2.02.7, 3.3-3.6GCC 4.8Bazel 0.4.55.18
tensorflow_gpu-1.1.02.7, 3.3-3.6GCC 4.8Bazel 0.4.25.18
tensorflow_gpu-1.0.02.7, 3.3-3.6GCC 4.8Bazel 0.4.25.18

Note that the minor CUDA version is required. For example, if you want to run TensorFlow 1.15, you must install CUDA 10.0. Installing CUDA 10.2 does not work with the following errors:

2022-06-21 21:10:57.123081: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 0 with properties: 
name: NVIDIA GeForce RTX 3090 major: 8 minor: 6 memoryClockRate(GHz): 1.695
pciBusID: 0000:b3:00.0
2022-06-21 21:10:57.123186: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcudart.so.10.0'; dlerror: libcudart.so.10.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/cuda/lib64
2022-06-21 21:10:57.123237: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcublas.so.10.0'; dlerror: libcublas.so.10.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/cuda/lib64
2022-06-21 21:10:57.123279: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcufft.so.10.0'; dlerror: libcufft.so.10.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/cuda/lib64
2022-06-21 21:10:57.123320: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcurand.so.10.0'; dlerror: libcurand.so.10.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/cuda/lib64
2022-06-21 21:10:57.123362: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcusolver.so.10.0'; dlerror: libcusolver.so.10.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/cuda/lib64
2022-06-21 21:10:57.123402: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcusparse.so.10.0'; dlerror: libcusparse.so.10.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/cuda/lib64
2022-06-21 21:10:57.123443: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcudnn.so.7'; dlerror: libcudnn.so.7: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/cuda/lib64
2022-06-21 21:10:57.123452: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1641] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.
Skipping registering GPU devices...

macOS

CPU (macOS)

VersionPython versionCompilerBuild tools
tensorflow-2.9.03.7-3.10Clang from xcode 10.14Bazel 5.0.0
tensorflow-2.8.03.7-3.10Clang from xcode 10.14Bazel 4.2.1
tensorflow-2.7.03.7-3.9Clang from xcode 10.11Bazel 3.7.2
tensorflow-2.6.03.6-3.9Clang from xcode 10.11Bazel 3.7.2
tensorflow-2.5.03.6-3.9Clang from xcode 10.11Bazel 3.7.2
tensorflow-2.4.03.6-3.8Clang from xcode 10.3Bazel 3.1.0
tensorflow-2.3.03.5-3.8Clang from xcode 10.1Bazel 3.1.0
tensorflow-2.2.03.5-3.8Clang from xcode 10.1Bazel 2.0.0
tensorflow-2.1.02.7, 3.5-3.7Clang from xcode 10.1Bazel 0.27.1
tensorflow-2.0.02.7, 3.5-3.7Clang from xcode 10.1Bazel 0.27.1
tensorflow-2.0.02.7, 3.3-3.7Clang from xcode 10.1Bazel 0.26.1
tensorflow-1.15.02.7, 3.3-3.7Clang from xcode 10.1Bazel 0.26.1
tensorflow-1.14.02.7, 3.3-3.7Clang from xcodeBazel 0.24.1
tensorflow-1.13.12.7, 3.3-3.7Clang from xcodeBazel 0.19.2
tensorflow-1.12.02.7, 3.3-3.6Clang from xcodeBazel 0.15.0
tensorflow-1.11.02.7, 3.3-3.6Clang from xcodeBazel 0.15.0
tensorflow-1.10.02.7, 3.3-3.6Clang from xcodeBazel 0.15.0
tensorflow-1.9.02.7, 3.3-3.6Clang from xcodeBazel 0.11.0
tensorflow-1.8.02.7, 3.3-3.6Clang from xcodeBazel 0.10.1
tensorflow-1.7.02.7, 3.3-3.6Clang from xcodeBazel 0.10.1
tensorflow-1.6.02.7, 3.3-3.6Clang from xcodeBazel 0.8.1
tensorflow-1.5.02.7, 3.3-3.6Clang from xcodeBazel 0.8.1
tensorflow-1.4.02.7, 3.3-3.6Clang from xcodeBazel 0.5.4
tensorflow-1.3.02.7, 3.3-3.6Clang from xcodeBazel 0.4.5
tensorflow-1.2.02.7, 3.3-3.6Clang from xcodeBazel 0.4.5
tensorflow-1.1.02.7, 3.3-3.6Clang from xcodeBazel 0.4.2
tensorflow-1.0.02.7, 3.3-3.6Clang from xcodeBazel 0.4.2

GPU (macOS)

VersionPython versionCompilerBuild toolscuDNNCUDA
tensorflow_gpu-1.1.02.7, 3.3-3.6Clang from xcodeBazel 0.4.25.18
tensorflow_gpu-1.0.02.7, 3.3-3.6Clang from xcodeBazel 0.4.25.18

CUDA → NVIDIA Driver compatibility

Official compatibility chart.

This compatibility requirement is generally less strict. The requirement is usually a least version requirement. However, it is recommended to install the nearest, requirement-met, and available driver.

Using the driver that comes with the CUDA ToolKit is the best choice because its compatibility is well tested.

Table 3. CUDA Toolkit and Corresponding Driver Versions
CUDA Toolkit Toolkit Driver Version
Linux x86_64 Driver Version Windows x86_64 Driver Version
CUDA 11.7 GA >=515.43.04 >=516.01
CUDA 11.6 Update 2 >=510.47.03 >=511.65
CUDA 11.6 Update 1 >=510.47.03 >=511.65
CUDA 11.6 GA >=510.39.01 >=511.23
CUDA 11.5 Update 2 >=495.29.05 >=496.13
CUDA 11.5 Update 1 >=495.29.05 >=496.13
CUDA 11.5 GA >=495.29.05 >=496.04
CUDA 11.4 Update 4 >=470.82.01 >=472.50
CUDA 11.4 Update 3 >=470.82.01 >=472.50
CUDA 11.4 Update 2 >=470.57.02 >=471.41
CUDA 11.4 Update 1 >=470.57.02 >=471.41
CUDA 11.4.0 GA >=470.42.01 >=471.11
CUDA 11.3.1 Update 1 >=465.19.01 >=465.89
CUDA 11.3.0 GA >=465.19.01 >=465.89
CUDA 11.2.2 Update 2 >=460.32.03 >=461.33
CUDA 11.2.1 Update 1 >=460.32.03 >=461.09
CUDA 11.2.0 GA >=460.27.03 >=460.82
CUDA 11.1.1 Update 1 >=455.32 >=456.81
CUDA 11.1 GA >=455.23 >=456.38
CUDA 11.0.3 Update 1 >= 450.51.06 >= 451.82
CUDA 11.0.2 GA >= 450.51.05 >= 451.48
CUDA 11.0.1 RC >= 450.36.06 >= 451.22
CUDA 10.2.89 >= 440.33 >= 441.22
CUDA 10.1 (10.1.105 general release, and updates) >= 418.39 >= 418.96
CUDA 10.0.130 >= 410.48 >= 411.31
CUDA 9.2 (9.2.148 Update 1) >= 396.37 >= 398.26
CUDA 9.2 (9.2.88) >= 396.26 >= 397.44
CUDA 9.1 (9.1.85) >= 390.46 >= 391.29
CUDA 9.0 (9.0.76) >= 384.81 >= 385.54
CUDA 8.0 (8.0.61 GA2) >= 375.26 >= 376.51
CUDA 8.0 (8.0.44) >= 367.48 >= 369.30
CUDA 7.5 (7.5.16) >= 352.31 >= 353.66
CUDA 7.0 (7.0.28) >= 346.46 >= 347.62

Official page that lists links to download CUDA Toolkit, including old versions.

Cudnn/CUDA compatibility

The compatibility requirement is most flexible. NVIDIA has separated cudnn builds for each cuda version. Here is the official link that lists all builds. Note that you might need to register an account or login to download.

However, TensorFlow does support specific cudnn versions. You have to look at the first section to select the working version of cudnn to install.

Nvidia driver → GCC compatibility

This requirement is relatively less strict. There are several ways to install an nvidia driver.

  • (Recommended) Install the driver that comes with the CUDA Toolkit. This is recommended because its compatibility with CUDA is well-tested.
  • (Recommended) Using OS package manager: pacman, apt, etc. Recently, they work very well. Especially, the package manager handles the burden of maintaining GCC version compatibility. Old driver version might not available in this way, but usually, it works even with old CUDA versions.
  • Install the nvidia driver by a runfile. It is difficult to download an old driver officially. The official page only provides the latest version.

If you install the driver packed with CUDA Toolkit, you have to meet the GCC version requirement. See the next section for this.

CUDA → GCC compatibility

By default, the CUDA installer will abort if the GCC version is too high. You can enforce the installation but any unexpected issue may occur without any warranty.

The document for each CUDA version's requirement is fragmented. There is no official page that shows a compatibility chart. The main page only lists the requirement for the latest CUDA version.

Fortunately, the community builds a compatibility chart here.

Release notes for CUDA Toolkit (CTK):

CUDA version SM Arch g++ icpc pgc++ xlC MSVC clang++ Linux driver thrust note
1.0 1.0-1.1 ? ? ?
1.1 1.0-1.1 ? ? ?
2.0 1.0-1.1 ? ? ?
2.1 1.0-1.3 ? ? ?
2.3.1 1.0-1.3 ? ? ?
3.0 1.0-2.0 ? ? ?
3.1 1.0-2.0 ? ? ?
3.2 1.0-2.1 ? 11.1 ?
4.0 1.0-2.1 <=4.4 11.1 ?
4.1 1.0-2.1 <=4.5 11.1 ?
4.2 1.0-2.1 <=4.6 11.1 ?
5.0 1.0-3.? <=4.6 11.1 ? ? 1.5.3
5.5 1.0-3.? <=4.8 12.1 ? ? 1.7.0 C++11 on host side supported; ICC fixed to build 20110811
6.0 1.0-5.0 <=4.8 13.1 ? 331.62 1.7.1
6.5 1.1-5.X <=4.8 14.0 ? ? ? 1.7.2 experimenal device side C++11 support; including this version, <thrust/sort.h> skrews up __CUDA_ARCH__ (must be undefined on host); deprecation of SM 11-13 (10 removed)
7.0.17 (RC) s. below <=4.9 15.0 >=14.9 13.1.1 ? 346.29 1.8.0 first official PGI support, first xlc string found; powerpc64 w. little endian supported
7.0.27 2.0-5.X <=4.9 15.0 >=14.9 13.1.1 2010-13 346.46 1.8.1 official C++11 support on device side
7.5 <=4.9 15.0 15.4 13.1 2010-13 3.5-3.6 352.41? 1.8.2 clang (host) on linux supported, __CUDACC_VER__ macros added
7.5.18 2.0-5.X <=4.9 15.0 15.4 13.1 2010-13 352.39 1.8.2
8.0.44 2.0-6.X <=5.3 15.0(.4)-16.0 16(.3)+ 13.1(.2) 2012-15 3.8-3.9 367.48 1.8.3-patch2 sm_60 (pascal) support added
8.0.61 2.0-6.X <=5.3 15.0(.4)-17.0 16(.3)+ 13.1(.2) 2012-15 3.8-3.9 375.26 1.8.3-patch2 nvcc 8 is incompatible with std::tuple in gcc 5.4+
9.0.69 (RC) 3.0-7.0 <=5.5 (<=6) 15.0(.4)-17.0 17 13.1(.2) 2012-17 3.8-3.9 ???.?? 1.9.0-patch4 device-side C++14; __CUDACC_VER__ deprecated for __CUDACC_VER_MAJOR/MINOR/BUILD__
9.0.103 (RC) 3.0-7.0 <=5.5 (<=6) 15.0(.4)-17.0 17 13.1(.2) 2012-17 3.8-3.9 384.59 1.9.0-patch4 same as above, __CUDACC_VER__ defined as #error rendering it fully broken
9.0.176 3.0-7.0 <=5.5 (<=6) (15.0-)17.0 17.1 13.1(.5) 2012-17 (3.8-)3.9 384.81 1.9.0-patch5 same as above
9.1.85 3.0-7.2 <=5.5 (<=6) (15.0-)17.0 17.X 13.1(.6) 2012-17 (3.8-)4.0 390.46 1.9.1-patch2 math_functions.hpp moved to crt/
9.1.85.1 cuBLAS 9.1.128: Volta GEMM kernels optimized
9.1.85.2 ptxas: fix address calculations using large immediate operands
9.1.85.3 cuBLAS: fixes to GEMM optimizations for convolutional sequence to sequence (seq2seq) models.
9.0-9.1 nvcc 9.0-9.1 is incompatible with std::tuple in gcc 6+
9.2.88 3.0-7.2 <=7.3.0 (<=7) (15.0-)17.0 17-18.X 13.1(.6),16.1 2012-17 (3.8-)5.0 396.26 1.9.2 CUTLASS 1.0 added; std::tuple fixed (prior GCC 6 issues)
9.2.148 396.37 1.9.2
10.0.130 3.0-7.5 <=7 (15.0-)18.0 17-18.X 13.1, 16.1 2013-17 (3.8-)6.0 410.48 1.9.3 CUDA Forward Compatible Upgrade
10.1.105 3.0-7.5 <=8 (15.0-)19.0 17-19.X 2013-19 (3.8-)7.0 418.39 1.9.4
10.1.168 (3.8-)8.0 418.67 10.1 "Update 1"
10.1.243 418.87 10.1 "Update 2"
10.2.89 3.0-7.5 <=8 (15.0-)19.0 18-19.X 13.1, 16.1 2015-19 (3.3-)8.* 440.33.01 1.9.7 sm_30,35,37,50 deprecated; nvcc: -allow-unsupported-compiler
11.0.1 (RC) NVCC:11.0.167 3.5-8.0 (5-)6-9.* (15.0-)19.1 18-20.1 13.1, 16.1 2015-19 3.2-9.0.0 450.36.06 1.9.9 macOS dropped; libs drop pre-C++11, deprecate pre-C++14 (GCC < 5, Clang < 6, and MSVC < 2017); Arm C/C++ 19.2 support
11.0.2-1 NVCC:11.0.194 (3.3/)6-9.0.0 450.51.05 nvcc: --Wext-lambda-captures-this
11.0.3 NVCC:11.0.221 ? ? ? ? ? ? ? 450.51.06 ? 11.0 "Update 1"; nvcc: --forward-unknown-to-host-compiler, --forward-unknown-to-host-linker flags
11.1.0 NVCC:11.1.74 3.5-8.6 (5-)6-10.0 (15.0-)19.1 18-20.1 13.1, 16.1 2017-19 (3.3/)6-10.0.0 455.23.05 1.9.10-1 Ubuntu@ppc64le deprecated; CUDA Enhanced Compatibility
11.1.1 NVCC:11.1.? ? ? ?
11.2.0 NVCC:11.2.67 460.27.04 1.10.0
11.2.1 NVCC:11.2.142 460.32.03 ? "Update 1"
11.2.2 NVCC:11.2.152 460.32.03 ? "Update 2"
11.3.0 NVCC:11.3.58 465.19.01 ? cu++flt added, Python Driver/RT bindings, alloca()
11.4.0 NVCC:11.4.48 6.0-... 470.42.01 ? sm30,32 and Ubuntu 16.04 dropped, C++11 stdlib for math
11.4.1 NVCC:11.4.100 6.0-11.0 ...-12.0 470.57.02 ? 11.4 "Update 1", fix g++ 10 issues with chrono headers of libstdc++; Ubuntu 16.04 dropped (x86)
11.4.2 NVCC:11.4.120 3.2-12.0 470.57.02 ? ...
11.5.0 NVCC:11.5.50 6.0-11.0 3.2-12.0 495.29.05 ? ...
11.5.1 NVCC:11.5.119
11.6.0 NVCC:11.6.55 6.0-11.0 adds VS2022 3.2-13.0 510.39.01 ? adds -arch=native and PTX generation in nvlink (for LTO workflows with PTX)
CUDA version SM Arch g++ icpc pgc++ xlC MSVC clang++ Linux driver thrust note

How to manage GCC versions manually

update-alternatives is a handy tool to manage multiple GCC versions in Ubuntu. For CentOS, you can use scl instead.

See the sample command lines below:

# sudo apt install -yq gcc-7 g++-7
# sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 7
# sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 7


# sudo update-alternatives --config gccgcc
There are 4 choices for the alternative gcc (providing /usr/bin/gcc).

  Selection    Path             Priority   Status
------------------------------------------------------------
  0            /usr/bin/gcc-10   10        auto mode
  1            /usr/bin/gcc-10   10        manual mode
  2            /usr/bin/gcc-7    7         manual mode
* 3            /usr/bin/gcc-8    8         manual mode
  4            /usr/bin/gcc-9    9         manual mode

Press <enter> to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/bin/gcc-7 to provide /usr/bin/gcc (gcc) in manual mode


# sudo update-alternatives --config g++
There are 4 choices for the alternative g++ (providing /usr/bin/g++).

  Selection    Path             Priority   Status
------------------------------------------------------------
  0            /usr/bin/g++-10   10        auto mode
  1            /usr/bin/g++-10   10        manual mode
  2            /usr/bin/g++-7    7         manual mode
* 3            /usr/bin/g++-8    8         manual mode
  4            /usr/bin/g++-9    9         manual mode

Press <enter> to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/bin/g++-7 to provide /usr/bin/g++ (g++) in manual mode
Use gcc version 7 with update-alternatives in Ubuntu
# gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39)
# sudo yum install centos-release-scl
# sudo yum install devtoolset-9
# scl enable devtoolset-9 bash
# gcc --version
gcc (GCC) 9.1.1 20190605 (Red Hat 9.1.1-2)
Use gcc version 9 with scl in CentOS

Other compatibilities

For other packages such as TensorFlow Probability, TensorFlow Datasets. The best way now is to look at their Releases pages on GitHub (TF Probability, TF Datasets) to find the compatible version. Looking at the release date is a nice trick to make it quicker.

For example, for TensorFlow 1.15, the compatible versions for TensorFlow Probability is 0.7, for TensorFlow Datasets is 3.2.1.