pythonprotocol-buffersgrpc

Why am I getting incompatibility of protobuf while install grpcio-tools?


When I want to install grpcio-tools using command:

python3 -m pip install grpcio-tools

enter image description here

While on the other hand when I want to run pip3 install mysql-connector-python to install mysql-connector-python:

enter image description here

What should I do for this incompatibility?

whereis protoc
protoc: /usr/local/bin/protoc


 pip show protobuf
 Name: protobuf
 Version: 3.20.1
 Summary: Protocol Buffers
 Home-page: https://developers.google.com/protocol-buffers/
 Author: None
 Author-email: None
 License: BSD-3-Clause
 Location: /home/lfathi/.local/lib/python3.8/site-packages
 Requires: 
 Required-by: mysql-connector-python, grpcio-tools

protoc --version
 libprotoc 3.2.0

which causes problem in running grpc


Solution

  • mysql-connector-python does appear to require protobuf:

    python3 -m venv venv
    source venv/bin/activate
    python3 -m pip install mysql-connector-python==8.0.31
    python3 -m pip freeze
    

    Yields:

    mysql-connector-python==8.0.31
    protobuf==3.20.1
    

    Or /path/to/venv/lib/python3.9/site-packages/mysql_connector_python-8.0.31.dist-info/METADATA

    Metadata-Version: 2.1
    Name: mysql-connector-python
    Version: 8.0.31
    Summary: MySQL driver written in Python
    Home-page: http://dev.mysql.com/doc/connector-python/en/index.html
    Author: Oracle and/or its affiliates
    Author-email: 
    License: GNU GPLv2 (with FOSS License Exception)
    Download-URL: http://dev.mysql.com/downloads/connector/python/
    Keywords: mysql db
    Platform: UNKNOWN
    [edited]
    Requires-Dist: protobuf (<=3.20.1,>=3.11.0)
    [edited]
    

    Google made breaking changes to the Python implementation of Protocol Buffers between 3.20.1 and 4.20.1.

    You need to find a grpcio-tools release that uses <=3.20.1. Curiously, 1.46.0 should work (03-May-2022) as it's beween protobuf 3.20.1 (21-Apr-2022) and 3.20.2 (13-Sep-2022) but, this also fails.

    Please try:

    python3 -m pip install mysql-connector-python==8.0.31
    python3 -m pip install grpcio-tools==1.44.0
    
    python3 -m pip freeze
    

    Yields:

    grpcio==1.51.1
    grpcio-tools==1.44.0
    mysql-connector-python==8.0.31
    protobuf==3.20.3