The grpcio package doesn't actually depend on protobuf. Only generated code
(i.e. _pb2.py and _pb2_grpc.py) have this dependency. Instead, you'll want
to build the protobuf wheel from the protobuf repository and use that
alongside an off-the-shelf grpcio wheel.
Also, to answer the obvious follow-up question: "Why do we have a vendored
protobuf directory in our repo at all then?". The grpcio-tools wheel *does
*build
in the libprotobuf native code to generate the aforementioned _pb2.py and
_pb2_grpc.py files.
On Thursday, January 6, 2022 at 10:33:54 PM UTC-8 hr d wrote:
> I added some log codes in grpc/third_party/protobuf/src/google/protobuf
> code, to help locate the problem, i install grpc python from source, but
> The change did not take effect. Please give me some advice, thanks.
>
>
> *Supported Python Versions*
>
> Python 3.7.9
>
> *What operating system (Linux, Windows,...) and version?*
>
> Ubuntu 18.04.5 LTS
>
> *What did you do?*
>
> I added some log codes in grpc/third_party/protobuf/src/google/protobuf
> codeļ¼ then i compiled protobuf , compiled grpc and install grpc python
> from source
>
>
>
>
>
>
> *mkdir -p "third_party/protobuf/cmake/build"cd
> "third_party/protobuf/cmake/build"cmake -Dprotobuf_BUILD_TESTS=OFF
> -DCMAKE_BUILD_TYPE=Release ..make -j14 installpopdmake -j14*
>
> i modified setup.py, add this code:
> *CORE_C_FILES = filter(lambda x: 'third_party/protobuf' not in x,
> CORE_C_FILES)*
> *PROTOBUF_INCLUDE = (os.path.join('/usr', 'include', 'protobuf'),)*
> EXTENSION_INCLUDE_DIRECTORIES = ((PYTHON_STEM,) + CORE_INCLUDE +
> ABSL_INCLUDE +
> ADDRESS_SORTING_INCLUDE + CARES_INCLUDE +
> RE2_INCLUDE + PROTOBUF_INCLUDE +
> SSL_INCLUDE + UPB_INCLUDE +
> UPB_GRPC_GENERATED_INCLUDE +
> UPBDEFS_GRPC_GENERATED_INCLUDE +
> XXHASH_INCLUDE + ZLIB_INCLUDE)
>
> then i run:
>
>
> *pip install -rrequirements.txtGRPC_PYTHON_BUILD_WITH_CYTHON=1 pip install
> .*
>
> *What did you expect to see?*
>
> Changes for Protobuf take effect
>
> *What did you see instead?*
>
> Changes for Protobuf did not take effect
>
>
>
>
--
You received this message because you are subscribed to the Google Groups
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/grpc-io/fff4cc45-c5e6-4b25-9a0a-50b3de6b3e85n%40googlegroups.com.