Install specific version of Bazel

We can easily install a specific version of Bazel using the version specific installer for different OS like Ubuntu, RHEL and others. We may need to specific Bazel version as different TensorFlow versions depend on different Bazel version.

To install a specific version of Bazel, follow the following steps:

  • Get the bazel installer for the specific version
  • Install using the above bazel installer
  • Copy the installed bazel to correct location

In short, the steps are:

chmod +x bazel-<version>-installer-linux-x86_64.sh

./bazel-<version>-installer-linux-x86_64.sh --user

cp -r /home/opengenus/bin/bazel* /usr/bin/

Get the bazel installer for the specific version

To get a specific Bazel install script for a specific version, go to the release page on Bazel GitHub repository, locate the correct version and download the correct installer for your Operating System.

Go to Release page on Bazel

Locate the specific version and download the installer from the "assets" tab.

Alternatively, you can copy the URL of the installer and use this command:

wget https://github.com/bazelbuild/bazel/releases/download/3.6.0/bazel-3.6.0-installer-linux-x86_64.sh

Once downloaded, you will have this file:

bazel-3.6.0-installer-linux-x86_64.sh

Install using the above bazel installer

To install using the above installer, just type the following command and follow the instructions:

./bazel-<version>-installer-linux-x86_64.sh --user

For our specific version, the command will be:

./bazel-3.6.0-installer-linux-x86_64.sh --user

Copy the installed bazel to correct location

Copy the installed files to /usr/bin so that the system can detect the Bazel directly.

cp -r /home/opengenus/bin/bazel* /usr/bin/

Once done, you may need to restart your session, so that the commands can find the new Bazel build. Enjoy.