python -m grpc_tools.protoc --version
libprotoc 3.21.6
~/bess-rs$ pip install --user protobuf grpcio scapy grpcio-tools
Requirement already satisfied: protobuf in /home/austin/.local/lib/python3.8/site-packages (4.21.7)
Requirement already satisfied: grpcio in /home/austin/.local/lib/python3.8/site-packages (1.49.1)
Requirement already satisfied: scapy in /home/austin/.local/lib/python3.8/site-packages (2.4.5)
Requirement already satisfied: grpcio-tools in /home/austin/.local/lib/python3.8/site-packages (1.49.1)
Requirement already satisfied: six>=1.5.2 in /home/austin/.local/lib/python3.8/site-packages (from grpcio) (1.16.0)
Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (from grpcio-tools) (45.2.0)
What operating system (Linux, Windows,...) and version?
Linux (Ubuntu WSL)
What runtime / compiler are you using (e.g. python version or version of gcc)
python --version
Python 3.8.10
What did you do?
I am using the following command template to compile the .proto files in my build.rs
file located here: https://github.com/eshikafe/bess-rs/blob/master/build.rs
python -m grpc_tools.protoc --proto_path={srcdir} --python_out={outdir} --grpc_python_out={outdir} {proto_file}
What did you expect to see?
This file, expected_builtin_pb.zip, contains the generated python code I expect
What did you see instead?
This file, generated_builtin_pb.zip, is what I get whenever I run this build script: https://github.com/eshikafe/bess-rs/blob/master/build.rs
Anything else we should know about your project / environment?
> bessctl/bessctl
Traceback (most recent call last):
File "bessctl/bessctl", line 51, in <module>
from pybess.bess import *
File "/home/austin/bess-rs/bessctl/../pybess/bess.py", line 61, in <module>
from builtin_pb import bess_msg_pb2 as bess_msg
File "/home/austin/bess-rs/pybess/builtin_pb/bess_msg_pb2.py", line 18, in <module>
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0e\x62\x65ss_msg.proto\x12\x07\x62\x65ss.pb\x1a\x19google/protobuf/any.proto\x1a\x0b\x65rror.proto\"\x0e\n\x0c\x45mptyRequest\".\n\rEmptyResponse\x12\x1d\n\x05\x65rror\x18\x01 \x01(\x0b\x32\x0e.bess.pb.Error\"A\n\x0fVersionResponse\x12\x1d\n\x05\x65rror\x18\x01 \x01(\x0b\x32\x0e.bess.pb.Error\x12\x0f\n\x07version\x18\x02
\x01(\x0b\x32\x14.google.protobuf.Any\"!\n\x12PauseWorkerRequest\x12\x0b\n\x03wid\x18\x01 \x01(\x03\"\"\n\x13ResumeWorkerRequest\x12\x0b\n\x03wid\x18\x01 \x01(\x03\x62\x06proto3')
TypeError: Couldn't build proto file into descriptor pool: duplicate file name (bess_msg.proto)
There is no duplicate file name anywhere.
The .proto files are located here: https://github.com/eshikafe/bess-rs/tree/master/protobuf
Interestingly, when I downgrade the pip python packages, it gives me the expected result.
austin:~/bess-rs$ pip install --user protobuf==3.20.1 grpcio==1.46.0 grpcio-tools==1.46.0
Requirement already satisfied: protobuf==3.20.1 in /home/austin/.local/lib/python3.8/site-packages (3.20.1)
Requirement already satisfied: grpcio==1.46.0 in /home/austin/.local/lib/python3.8/site-packages (1.46.0)
Requirement already satisfied: grpcio-tools==1.46.0 in /home/austin/.local/lib/python3.8/site-packages (1.46.0)
Requirement already satisfied: six>=1.5.2 in /home/austin/.local/lib/python3.8/site-packages (from grpcio==1.46.0) (1.16.0)
Requirement already satisfied: setuptools in /home/austin/.local/lib/python3.8/site-packages (from grpcio-tools==1.46.0) (65.5.1)
austin:~/bess-rs$ bessctl/bessctl
Type "help" for more information.
Connection to localhost:10514 failed
Perhaps bessd daemon is not running locally? Try "daemon start".
<disconnected> $
<disconnected> $
<disconnected> $
Thanks @gnossen . A fix for this issue has been provided here: protocolbuffers/protobuf#10158
Will this be included in grpc?