Bug 273309 - databases/py-mysql-connector-python: errors with devel/py-protobuf 4.23.2,1
Summary: databases/py-mysql-connector-python: errors with devel/py-protobuf 4.23.2,1
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Muhammad Moinur Rahman
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-08-23 15:03 UTC by Dan Langille
Modified: 2023-09-05 04:57 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Langille freebsd_committer freebsd_triage 2023-08-23 15:03:41 UTC
I'm seeing this error:

[dvl@fmd-tepot-01tst:~] $ foo
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py", line 581, in _build_master
    ws.require(__requires__)
  File "/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py", line 909, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py", line 800, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (protobuf 4.23.2 (/usr/local/lib/python3.9/site-packages), Requirement.parse('protobuf<=4.21.12,>=4.21.1'), {'mysql-connector-python'})

..... then more stuff related to "During handling of the above exception, another exception occurred"


This is with:

* FreeBSD 12.4-RELEASE-p1
* 2023Q3 ports tree (with some local backports from head)
* py39-protobuf-4.24.1,1 (notice the ,1 epoch)
* py39-mysql-connector-python-8.1.0
* python39-3.9.17

To get us running, I've patched out a line from patch-setup.py:

[dvl@ava-pkg-02prd:/usr/local/poudriere/ports/2023Q3] $ cat databases/py-mysql-connector-python/files/patch-setup.py 
--- setup.py.orig	2023-08-23 14:48:53 UTC
+++ setup.py
@@ -137,7 +137,6 @@ setup(
     ext_modules=EXTENSIONS,
     cmdclass=COMMAND_CLASSES,
     python_requires=">=3.8",
-    install_requires=["protobuf>=4.21.1,<=4.21.12"],
     extras_require={
         "dns-srv": ["dnspython>=1.16.0,<=2.3.0"],
         "compression": ["lz4>=2.1.6,<=4.3.2", "zstandard>=0.12.0,<=0.19.0"],
[dvl@ava-pkg-02prd:/usr/local/poudriere/ports/2023Q3] $ 

I don't know if this is an issue with epoch or not.
Comment 1 Po-Chuan Hsieh freebsd_committer freebsd_triage 2023-08-25 19:50:50 UTC
The epoch is used only in FreeBSD version check. It does not affect python. py-protobuf's version in Python is 4.24.1 (currently).

Before I update devel/py-protobuf, I always checked all dependent ports. Since py-mysql-connector-python's RUN_DEPENDS says >=3.11.0, it should be OK. However, it actually requires 4.21.1 to 4.21.2 (install_requires in setup.py).

If latest py-protobuf works fine.
The simplest patch is as follows:

--- setup.py.orig	2023-08-23 14:48:53 UTC
+++ setup.py
@@ -137,7 +137,7 @@ setup(
     ext_modules=EXTENSIONS,
     cmdclass=COMMAND_CLASSES,
     python_requires=">=3.8",
-    install_requires=["protobuf>=4.21.1,<=4.21.12"],
+    install_requires=["protobuf>=4.21.1"],
     extras_require={
         "dns-srv": ["dnspython>=1.16.0,<=2.3.0"],
         "compression": ["lz4>=2.1.6,<=4.3.2", "zstandard>=0.12.0,<=0.19.0"],

And RUN_DEPENDS should be updated to match the above range.

Pass this PR to maintainer.
Comment 2 commit-hook freebsd_committer freebsd_triage 2023-09-05 04:57:18 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=39ca6f0f2af097b21300f4f20c35a80f9716035a

commit 39ca6f0f2af097b21300f4f20c35a80f9716035a
Author:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
AuthorDate: 2023-09-05 04:55:13 +0000
Commit:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
CommitDate: 2023-09-05 04:56:13 +0000

    databases/py-mysql-connector-python: Runtime fix with newer protobuf

    PR:             273309
    Reported by:    dvl

 databases/py-mysql-connector-python/Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)