Installing TensorFlow

You can install TensorFlow in your enviroument using different ways, such as pip and Apptainer. This documentation focus on installing and utilizing TensorFlow through Apptainer container.

Apptainer Container

Apptainer is a container platform for building and running Linux containers that packages software, libraries, and runtime compilers in a self-contained enviroment. To learn more refer to the Apptainer Documentation.

TensorFlow Docker Image isolates the TensorFlow installation from the rest of the system. TensorFlow programs are run within this virtual environment that can share resources with its host machine (access directories, use the GPU, connect to the Internet, etc.). To install TensorFlow on Discovery, you can download and build its container from the Docker Hub through the Apptainer commands as shown in Building Containers. For example, to install the latest version of TensorFlow CPU version, run the following command:

apptainer build tensorflow.sif docker://tensorflow/tensorflow

This will create a SIF image named tensorflow.sif, which you can use to run your programs.

Image Tags

TensorFlow image releases are tagged with the following format:

  • latest: the latest release of the TensorFlow CPU image.

  • nightly: unstable release of the TensorFlow image.

  • version: version of the TensorFlow binary image to download, for example: 2.1.0

For example, to build the latest release of GPU version using Apptainer, run the following command,

apptainer build tnesorJupyter.sif docker://tensorflow/tensorflow:latest-gpu

For more tags, see TensorFlow Tags.