Installing Tensorflow 2.9 with GPU Support

You have come here because you want to install Tensorflow 2.9, and you want to get it right for the first time. Typically installing Tensorflow is hard work due to the number of dependencies. The good news is that since Tensorflow 2.5, the basic dependencies haven’t changed much, CUDA 11.2 and CuDNN 8.1 is still required except for the Python version required.

Which TensorFlow and CUDA version combinations are compatible?

Whenever you are in doubt on what version of CUDA and CuDNN you need, just check Tensorflow’s compatibility matrix available from this link.

Below you can see an extract of that table, with the versions of CUDA and cuDNN that are required if you are installing and compiling Tensorflow from the source:

GPU

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

This means that if you want to install Tensorflow manually, you can simply follow the steps outlined for Tensorflow 2.5. You can find that guide below:

If you don’t want to waste time installing each component by hand, there is no shame in just using a docker container with Tensorflow. I have created a very simple guide on how to install Tensorflow using docker:

Resources

Recommended Courses for Data Science