Reputation: 341
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
Upvotes: 3
Views: 8030
Reputation: 961
I had the same error trying to build a container image. It errored at RUN pip install -r requirements.txt
with the below:
ERROR: Cannot install grpcio-status==1.53.0, mysql-connector-python==8.0.32 and protobuf==4.22.1
because these package versions have conflicting dependencies
grpcio-status 1.53.0 depends on protobuf>=4.21.6
mysql-connector-python 8.0.32 depends on protobuf<=3.20.3 and >=3.11.0
To fix this you could try to:
1. loosen the range of package versions you have specified
2. remove package versions to allow pip attempt to solve the dependency conflict
Removing the package version (as in suggested fix 2) solved the problem for me.
requirements.txt
(dependencies with package versions):grpcio-status==1.53.0
mysql-connector-python==8.0.32
protobuf==4.22.1
grpcio-status
mysql-connector-python
protobuf
Alternatively, install the packages together as below. Pip will attempt to solve the conflict:
pip install mysql-connector-python grpcio-tools protobuf
Upvotes: 1
Reputation: 40296
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.
Upvotes: 1