Install TensorFlow Ranking
Stay organized with collections
Save and categorize content based on your preferences.
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_ranking
pip 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_ranking
Build from source
You can also install from source, which requires the
Bazel build system.
Install Bazel, Git and Pip.
sudo apt-get update
sudo apt-get install bazel git python3-pip python3-venv
Clone the TensorFlow Ranking repository.
git clone https://github.com/tensorflow/ranking.git
Build TensorFlow Ranking wheel file and store them in a
/tmp/ranking_pip
folder.
cd ranking # folder cloned in Step 2.
bazel build //tensorflow_ranking/tools/pip_package:build_pip_package
bazel-bin/tensorflow_ranking/tools/pip_package/build_pip_package \
/tmp/ranking_pip
Activate a venv
environment.
python3 -m venv --system-site-packages venv
source venv/bin/activate
Install the wheel package in your venv
environment.
pip install /tmp/ranking_pip/tensorflow_ranking*.whl
Optionally, 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.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2021-11-11 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2021-11-11 UTC."],[],[],null,["# Install TensorFlow Ranking\n\n\u003cbr /\u003e\n\nThere are several ways to set up your environment to use the TensorFlow Ranking\nlibrary.\n\n- 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](/ranking/tutorials/quickstart)).\n- To use the Ranking library on a local machine, install the `tensorflow_ranking` pip package.\n- If you have a unique machine configuration, you can build the package from source, using the [Build from source](#build_source) instructions.\n\nInstall TensorFlow Ranking using pip\n------------------------------------\n\nInstall using pip. \n\n pip install --upgrade tensorflow_ranking\n\nBuild from source\n-----------------\n\nYou can also install from source, which requires the\n[Bazel](https://bazel.build/) build system.\n\n1. Install Bazel, Git and Pip.\n\n sudo apt-get update\n sudo apt-get install bazel git python3-pip python3-venv\n\n2. Clone the TensorFlow Ranking repository.\n\n ```bash\n git clone https://github.com/tensorflow/ranking.git\n ```\n\n \u003cbr /\u003e\n\n3. Build TensorFlow Ranking wheel file and store them in a\n `/tmp/ranking_pip` folder.\n\n cd ranking # folder cloned in Step 2.\n bazel build //tensorflow_ranking/tools/pip_package:build_pip_package\n bazel-bin/tensorflow_ranking/tools/pip_package/build_pip_package \\\n /tmp/ranking_pip\n\n4. Activate a `venv` environment.\n\n python3 -m venv --system-site-packages venv\n source venv/bin/activate\n\n5. Install the wheel package in your `venv` environment.\n\n pip install /tmp/ranking_pip/tensorflow_ranking*.whl\n\n6. Optionally, run all TensorFlow Ranking tests.\n\n bazel test //tensorflow_ranking/...\n\nFor more information about installing Python, pip, TensorFlow, and working with\nPython virtual environments, see\n[Install TensorFlow with pip](/install/pip#2.-create-a-virtual-environment-recommended)."]]