pythonprotocol-buffersgrpc

getting incompability 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][1]][1]

while on the other hand when I want to run pip3 install mysql-connector-python to install mysql-connector-python: [![enter image description here][2]][2]

what should I do for this incompability?

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 [1]: https://i.sstatic.net/NZ15N.png [2]: https://i.sstatic.net/LXpM1.png


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
    

    Please don't use screenshots in stack overflow questions when it is possible to copy-and-paste the text instead. Using images inhibits the ability for others to copy-and-paste content to help answer questions and there's no guarantee that the images will last as long as the questions.