'Making Bazel pip_parse select different requirements file based on platform
I currently use bazel to load a requirement.txt file as follows:
load("@rules_python//python:pip.bzl", "pip_parse")
pip_parse(
name = "python_libs",
requirements_lock = "//tools:python_requirements_lock.txt",
python_interpreter_target = "@mypython//:bin/python3",
)
This contains a non GPU version of a library
torch==1.11.0
However, i want to target the GPU version torch==1.11.0+cu115 if there is a GPU present or NVIDIA drivers present on my system. How can I do something to ensure that bazel can detect the system type, and select the appropriate library or even requirements file?
I would like to use platform_select such as
bazel build //:myproject --platforms=//:gpu to do this but I don't know how to make that work with pip_parse
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
