Make bazel use local copy of a pip package if available

72 Views Asked by At

How can I make Bazel use a local pip package (if it's already available on the system and matches the version requirement). If the package is not available locally, I want Bazel to download and install it in the sandbox.

Ideally, I want this all abstracted in a simple rule that I can add as dependency to my py_library or py_binary rules.

Context: I am using Bazel for developing some python libraries. I have several separate projects, all of which depend on pytorch, which is 4GB in size. With 4 separate projects, this is a lot of space to install 4 times in separate sandboxes. My target platform is Linux.

0

There are 0 best solutions below