There are several ways to set up your environment to use the TensorFlow Ranking library.
- The easiest way to learn and use TensorFlow Ranking is run any of the tutorials Google Colab. Select the link at the top of the Quickstart tutorial).
- To use the Ranking library on a local machine, install the
tensorflow_rankingpip package. - If you have a unique machine configuration, you can build the package from source, using the Build from source instructions.
Install TensorFlow Ranking using pip
Install using pip.
pip install --upgrade tensorflow_rankingBuild from source
You can also install from source, which requires the Bazel build system.
Install Bazel, Git and Pip.
sudo apt-get updatesudo apt-get install bazel git python3-pip python3-venvClone the TensorFlow Ranking repository.
git clone https://github.com/tensorflow/ranking.git
Build TensorFlow Ranking wheel file and store them in a
/tmp/ranking_pipfolder.cd ranking # folder cloned in Step 2.bazel build //tensorflow_ranking/tools/pip_package:build_pip_packagebazel-bin/tensorflow_ranking/tools/pip_package/build_pip_package \ /tmp/ranking_pipActivate a
venvenvironment.python3 -m venv --system-site-packages venvsource venv/bin/activateInstall the wheel package in your
venvenvironment.pip install /tmp/ranking_pip/tensorflow_ranking*.whlOptionally, run all TensorFlow Ranking tests.
bazel test //tensorflow_ranking/...
For more information about installing Python, pip, TensorFlow, and working with Python virtual environments, see Install TensorFlow with pip.