Is it possible to make binary from pip install available in bazel build?

282 views
Skip to first unread message

John Wong

unread,
Aug 18, 2023, 1:05:32 AM8/18/23
to bazel-discuss
Let say I have a PyPI package named "mypy-protobuf". Normally when I pip install mypy-protobuf, the "protoc" binary is dropped into a bin directory, let say /usr/local/bin.

I already have pip_parse and then install the python dependency in WORKSPACE.

In my BUILD.bazel I added
python_grpc_library(
    name = "train_py_grpc",
    protos = [":train"],
    options = {
        "@rules_proto_grpc//python:grpc_python_plugin": [],
    },
    deps = [
        requirement("mypy-protobuf")
    ],



Instead, I am getting this:
protoc-gen-mypy: program not found or is not executable
Please specify a program using absolute path or make sure the program is available in your PATH system variable


This means the protoc that comes with the pip installing package is not visible? Is that what I should expect?

So what is the point of installing dependency in workspace? Does "deps" here help at all?

If I have some misunderstanding, happy to learn.

PS: There was a recent discussion of doing what i am looking for https://groups.google.com/g/bazel-discuss/c/RSKau5N4cU0/m/hWZy0FrXAQAJ but it involves compiling the plugin myself all over. I'd like to avoid that + writing a new rule.

Reply all
Reply to author
Forward
0 new messages