Update to python3-mysqlclient conflicts with python3-mysql

My latest attempts to update my Fedora 37 system fail because one of my installed packages now has python3-mysqlclient-2.1.0-3.fc37.x86_64 as a dependency and several files in that package conflict with files in python3-mysql-1.4.6-11.fc37.x86_64 which is already installed on my system. In turn, a number of other packages fail to update because they need python3-mysql-1.4.6-11.fc37.x86_64. Any suggestions? Any help greatly appreciated!

Darron

$ dnf repoquery -l python3-mysql{,client} should give you an idea of what’s going on here. Alternatively, you might consider using pip with venv to manage python dependencies per-project and avoid global conflicts that way.

In this case, it looks like these are basically different versions of the same Python “site-package” (MySQLdb), which is why they conflict. If dnf allowed you to install both, one package would overwrite at least part of the other’s files.

Scott,

Thanks for the guidance! I’ll follow up on your suggestions and see what I can learn.

Darron

1 Like

When there are conflicting packages like that from the same repo it often is a case of the mirrors not being in sync and thus 2 different versions are seen. The fix in that case is to wait a few hours or a day and try again. Once the mirrors are in sync the issue usually goes away.

If the packages are from fedora and some other 3rd party repo then the conflicts will need to be solved by only using one of the two conflicting repos.

I just checked and python3-mysql 1.4.6-11and python3-mysqlclient 2.1.0-3 both come from fedora and do not conflict if both are installed.

You said this is a result of some other package you already have installed and trying to do an update so we would need to know exactly what other *mysql* packages are installed that are causing the issue.

A list of all the packages that are showing the conflicts would be helpful in narrowing down the one that is at issue, assuming that this is not caused by a temporary issue such as mirrors out of sync and that it does not disappear once the mirrors finish syncing.

I do get conflicts, however.

[root@newbox ~]# dnf install  python3-mysql python3-mysqlclient
Last metadata expiration check: 0:50:12 ago on Thu 15 Dec 2022 06:12:32 CET.
Dependencies resolved.
====================================================================================================================
 Package                            Architecture          Version                       Repository             Size
====================================================================================================================
Installing:
 python3-mysql                      x86_64                1.4.6-11.fc37                 fedora                117 k
 python3-mysqlclient                x86_64                2.1.0-3.fc37                  fedora                106 k

Transaction Summary
====================================================================================================================
Install  2 Packages

Total download size: 223 k
Installed size: 660 k
Is this ok [y/N]: y
Downloading Packages:
(1/2): python3-mysqlclient-2.1.0-3.fc37.x86_64.rpm                                  503 kB/s | 106 kB     00:00    
(2/2): python3-mysql-1.4.6-11.fc37.x86_64.rpm                                       545 kB/s | 117 kB     00:00    
--------------------------------------------------------------------------------------------------------------------
Total                                                                               341 kB/s | 223 kB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'dnf clean packages'.
Error: Transaction test error:
  file /usr/lib64/python3.11/site-packages/MySQLdb/__init__.py conflicts between attempted installs of python3-mysql-1.4.6-11.fc37.x86_64 and python3-mysqlclient-2.1.0-3.fc37.x86_64
  file /usr/lib64/python3.11/site-packages/MySQLdb/__pycache__/__init__.cpython-311.opt-1.pyc conflicts between attempted installs of python3-mysql-1.4.6-11.fc37.x86_64 and python3-mysqlclient-2.1.0-3.fc37.x86_64
  file /usr/lib64/python3.11/site-packages/MySQLdb/__pycache__/__init__.cpython-311.pyc conflicts between attempted installs of python3-mysql-1.4.6-11.fc37.x86_64 and python3-mysqlclient-2.1.0-3.fc37.x86_64
  file /usr/lib64/python3.11/site-packages/MySQLdb/__pycache__/_exceptions.cpython-311.opt-1.pyc conflicts between attempted installs of python3-mysql-1.4.6-11.fc37.x86_64 and python3-mysqlclient-2.1.0-3.fc37.x86_64
  file /usr/lib64/python3.11/site-packages/MySQLdb/__pycache__/_exceptions.cpython-311.pyc conflicts between attempted installs of python3-mysql-1.4.6-11.fc37.x86_64 and python3-mysqlclient-2.1.0-3.fc37.x86_64
  file /usr/lib64/python3.11/site-packages/MySQLdb/__pycache__/connections.cpython-311.opt-1.pyc conflicts between attempted installs of python3-mysql-1.4.6-11.fc37.x86_64 and python3-mysqlclient-2.1.0-3.fc37.x86_64
  file /usr/lib64/python3.11/site-packages/MySQLdb/__pycache__/connections.cpython-311.pyc conflicts between attempted installs of python3-mysql-1.4.6-11.fc37.x86_64 and python3-mysqlclient-2.1.0-3.fc37.x86_64
  file /usr/lib64/python3.11/site-packages/MySQLdb/__pycache__/converters.cpython-311.opt-1.pyc conflicts between attempted installs of python3-mysql-1.4.6-11.fc37.x86_64 and python3-mysqlclient-2.1.0-3.fc37.x86_64
  file /usr/lib64/python3.11/site-packages/MySQLdb/__pycache__/converters.cpython-311.pyc conflicts between attempted installs of python3-mysql-1.4.6-11.fc37.x86_64 and python3-mysqlclient-2.1.0-3.fc37.x86_64
  file /usr/lib64/python3.11/site-packages/MySQLdb/__pycache__/cursors.cpython-311.opt-1.pyc conflicts between attempted installs of python3-mysql-1.4.6-11.fc37.x86_64 and python3-mysqlclient-2.1.0-3.fc37.x86_64
  file /usr/lib64/python3.11/site-packages/MySQLdb/__pycache__/cursors.cpython-311.pyc conflicts between attempted installs of python3-mysql-1.4.6-11.fc37.x86_64 and python3-mysqlclient-2.1.0-3.fc37.x86_64
  file /usr/lib64/python3.11/site-packages/MySQLdb/__pycache__/release.cpython-311.opt-1.pyc conflicts between attempted installs of

and quite a bit more.

1 Like

I’m not sure how you confirmed this, but they definitely conflict.

@knutsondc Please file a bug report on one or both of python-mysql/python-mysqlclient. If they conflict in files, they should have explicit Conflicts. Or if no-one uses the old version, it should be retired.

I had just done the preliminary test and saw no conflict. When I went further and got the actual installation conflicts so there should definitely be a bug filed and the older one retired.

If there are other packages triggering the conflict by requiring the conflicting packages as dependencies then that should be included in the bug report.

i have the same problem on Rel36 Fedora, glad to see someone is posting it too, here’s my info if it helps, this sample is from trying to update mythtv. Conflict between python3-mysqlclient-2.0.3-4 conflicts with file from package python3-mysql-1.4.6-9. Is it best to wait for a fix or try the python pip upgrade, and is the pip upgrade a commitment to do that going forward versus using dnf? Thanks.

Output

dnf update mythtv
Last metadata expiration check: 3:33:01 ago on Thu 15 Dec 2022 08:45:54 AM EST.
Dependencies resolved.
===============================================================================
 Package             Arch   Version               Repository              Size
===============================================================================
Upgrading:
 mytharchive         x86_64 32.0-6.76.20221129git44f88ed468.fc36
                                                  rpmfusion-free-updates  12 M
 mythbrowser         x86_64 32.0-6.76.20221129git44f88ed468.fc36
                                                  rpmfusion-free-updates 106 k
 mythffmpeg          x86_64 32.0-6.76.20221129git44f88ed468.fc36
                                                  rpmfusion-free-updates 8.3 M
 mythgame            x86_64 32.0-6.76.20221129git44f88ed468.fc36
                                                  rpmfusion-free-updates 179 k
 mythmusic           x86_64 32.0-6.76.20221129git44f88ed468.fc36
                                                  rpmfusion-free-updates 644 k
 mythnews            x86_64 32.0-6.76.20221129git44f88ed468.fc36
                                                  rpmfusion-free-updates 111 k
 mythplugins         x86_64 32.0-6.76.20221129git44f88ed468.fc36
                                                  rpmfusion-free-updates  11 k
 mythtv              x86_64 32.0-6.76.20221129git44f88ed468.fc36
                                                  rpmfusion-free-updates  26 k
 mythtv-backend      x86_64 32.0-6.76.20221129git44f88ed468.fc36
                                                  rpmfusion-free-updates 7.7 M
 mythtv-base-themes  x86_64 32.0-6.76.20221129git44f88ed468.fc36
                                                  rpmfusion-free-updates  13 M
 mythtv-common       x86_64 32.0-6.76.20221129git44f88ed468.fc36
                                                  rpmfusion-free-updates 4.4 M
 mythtv-docs         noarch 32.0-6.76.20221129git44f88ed468.fc36
                                                  rpmfusion-free-updates 114 k
 mythtv-frontend     x86_64 32.0-6.76.20221129git44f88ed468.fc36
                                                  rpmfusion-free-updates  12 M
 mythtv-libs         x86_64 32.0-6.76.20221129git44f88ed468.fc36
                                                  rpmfusion-free-updates 8.3 M
 mythtv-setup        x86_64 32.0-6.76.20221129git44f88ed468.fc36
                                                  rpmfusion-free-updates 143 k
 mythweather         x86_64 32.0-6.76.20221129git44f88ed468.fc36
                                                  rpmfusion-free-updates 412 k
 mythzoneminder      x86_64 32.0-6.76.20221129git44f88ed468.fc36
                                                  rpmfusion-free-updates 175 k
 perl-MythTV         noarch 32.0-6.76.20221129git44f88ed468.fc36
                                                  rpmfusion-free-updates  32 k
 php-MythTV          noarch 32.0-6.76.20221129git44f88ed468.fc36
                                                  rpmfusion-free-updates  22 k
 python3-MythTV      noarch 32.0-6.76.20221129git44f88ed468.fc36
                                                  rpmfusion-free-updates 335 k
Installing dependencies:
 python3-mysqlclient x86_64 2.0.3-4.fc36          fedora                  89 k

Transaction Summary
===============================================================================
Install   1 Package
Upgrade  20 Packages

Total size: 68 M
Is this ok [y/N]: y
.....................................
Error: Transaction test error:
  file /usr/lib64/python3.10/site-packages/MySQLdb/__init__.py from install of python3-mysqlclient-2.0.3-4.fc36.x86_64 conflicts with file from package python3-mysql-1.4.6-9.fc36.x86_64
  file /usr/lib64/python3.10/site-packages/MySQLdb/__pycache__/__init__.cpython-310.opt-1.pyc from install of python3-mysqlclient-2.0.3-4.fc36.x86_64 conflicts with file from package python3-mysql-1.4.6-9.fc36.x86_64
  file /usr/lib64/python3.10/site-packages/MySQLdb/__pycache__/__init__.cpython-310.pyc from install of python3-mysqlclient-2.0.3-4.fc36.x86_64 conflicts with file from package python3-mysql-1.4.6-9.fc36.x86_64
  file /usr/lib64/python3.10/site-packages/MySQLdb/__pycache__/_exceptions.cpython-310.opt-1.pyc from install of python3-mysqlclient-2.0.3-4.fc36.x86_64 conflicts with file from package python3-mysql-1.4.6-9.fc36.x86_64
  file /usr/lib64/python3.10/site-packages/MySQLdb/__pycache__/_exceptions.cpython-310.pyc from install of python3-mysqlclient-2.0.3-4.fc36.x86_64 conflicts with file from package python3-mysql-1.4.6-9.fc36.x86_64
  file /usr/lib64/python3.10/site-packages/MySQLdb/__pycache__/connections.cpython-310.opt-1.pyc from install of python3-mysqlclient-2.0.3-4.fc36.x86_64 conflicts with file from package python3-mysql-1.4.6-9.fc36.x86_64
  file /usr/lib64/python3.10/site-packages/MySQLdb/__pycache__/connections.cpython-310.pyc from install of python3-mysqlclient-2.0.3-4.fc36.x86_64 conflicts with file from package python3-mysql-1.4.6-9.fc36.x86_64
  file /usr/lib64/python3.10/site-packages/MySQLdb/__pycache__/converters.cpython-310.opt-1.pyc from install of python3-mysqlclient-2.0.3-4.fc36.x86_64 conflicts with file from package python3-mysql-1.4.6-9.fc36.x86_64
  file /usr/lib64/python3.10/site-packages/MySQLdb/__pycache__/converters.cpython-310.pyc from install of python3-mysqlclient-2.0.3-4.fc36.x86_64 conflicts with file from package python3-mysql-1.4.6-9.fc36.x86_64
  file /usr/lib64/python3.10/site-packages/MySQLdb/__pycache__/cursors.cpython-310.opt-1.pyc from install of python3-mysqlclient-2.0.3-4.fc36.x86_64 conflicts with file from package python3-mysql-1.4.6-9.fc36.x86_64
  file /usr/lib64/python3.10/site-packages/MySQLdb/__pycache__/cursors.cpython-310.pyc from install of python3-mysqlclient-2.0.3-4.fc36.x86_64 conflicts with file from package python3-mysql-1.4.6-9.fc36.x86_64
  file /usr/lib64/python3.10/site-packages/MySQLdb/__pycache__/release.cpython-310.opt-1.pyc from install of python3-mysqlclient-2.0.3-4.fc36.x86_64 conflicts with file from package python3-mysql-1.4.6-9.fc36.x86_64
  file /usr/lib64/python3.10/site-packages/MySQLdb/__pycache__/release.cpython-310.pyc from install of python3-mysqlclient-2.0.3-4.fc36.x86_64 conflicts with file from package python3-mysql-1.4.6-9.fc36.x86_64
  file /usr/lib64/python3.10/site-packages/MySQLdb/__pycache__/times.cpython-310.opt-1.pyc from install of python3-mysqlclient-2.0.3-4.fc36.x86_64 conflicts with file from package python3-mysql-1.4.6-9.fc36.x86_64
  file /usr/lib64/python3.10/site-packages/MySQLdb/__pycache__/times.cpython-310.pyc from install of python3-mysqlclient-2.0.3-4.fc36.x86_64 conflicts with file from package python3-mysql-1.4.6-9.fc36.x86_64
  file /usr/lib64/python3.10/site-packages/MySQLdb/_exceptions.py from install of python3-mysqlclient-2.0.3-4.fc36.x86_64 conflicts with file from package python3-mysql-1.4.6-9.fc36.x86_64
  file /usr/lib64/python3.10/site-packages/MySQLdb/_mysql.cpython-310-x86_64-linux-gnu.so from install of python3-mysqlclient-2.0.3-4.fc36.x86_64 conflicts with file from package python3-mysql-1.4.6-9.fc36.x86_64
  file /usr/lib64/python3.10/site-packages/MySQLdb/connections.py from install of python3-mysqlclient-2.0.3-4.fc36.x86_64 conflicts with file from package python3-mysql-1.4.6-9.fc36.x86_64
  file /usr/lib64/python3.10/site-packages/MySQLdb/constants/CLIENT.py from install of python3-mysqlclient-2.0.3-4.fc36.x86_64 conflicts with file from package python3-mysql-1.4.6-9.fc36.x86_64
  file /usr/lib64/python3.10/site-packages/MySQLdb/constants/CR.py from install of python3-mysqlclient-2.0.3-4.fc36.x86_64 conflicts with file from package python3-mysql-1.4.6-9.fc36.x86_64
  file /usr/lib64/python3.10/site-packages/MySQLdb/constants/ER.py from install of python3-mysqlclient-2.0.3-4.fc36.x86_64 conflicts with file from package python3-mysql-1.4.6-9.fc36.x86_64
  file /usr/lib64/python3.10/site-packages/MySQLdb/constants/__init__.py from install of python3-mysqlclient-2.0.3-4.fc36.x86_64 conflicts with file from package python3-mysql-1.4.6-9.fc36.x86_64
  file /usr/lib64/python3.10/site-packages/MySQLdb/constants/__pycache__/CLIENT.cpython-310.opt-1.pyc from install of python3-mysqlclient-2.0.3-4.fc36.x86_64 conflicts with file from package python3-mysql-1.4.6-9.fc36.x86_64
  file /usr/lib64/python3.10/site-packages/MySQLdb/constants/__pycache__/CLIENT.cpython-310.pyc from install of python3-mysqlclient-2.0.3-4.fc36.x86_64 conflicts with file from package python3-mysql-1.4.6-9.fc36.x86_64
  file /usr/lib64/python3.10/site-packages/MySQLdb/constants/__pycache__/CR.cpython-310.opt-1.pyc from install of python3-mysqlclient-2.0.3-4.fc36.x86_64 conflicts with file from package python3-mysql-1.4.6-9.fc36.x86_64
  file /usr/lib64/python3.10/site-packages/MySQLdb/constants/__pycache__/CR.cpython-310.pyc from install of python3-mysqlclient-2.0.3-4.fc36.x86_64 conflicts with file from package python3-mysql-1.4.6-9.fc36.x86_64
  file /usr/lib64/python3.10/site-packages/MySQLdb/constants/__pycache__/ER.cpython-310.opt-1.pyc from install of python3-mysqlclient-2.0.3-4.fc36.x86_64 conflicts with file from package python3-mysql-1.4.6-9.fc36.x86_64
  file /usr/lib64/python3.10/site-packages/MySQLdb/constants/__pycache__/ER.cpython-310.pyc from install of python3-mysqlclient-2.0.3-4.fc36.x86_64 conflicts with file from package python3-mysql-1.4.6-9.fc36.x86_64
  file /usr/lib64/python3.10/site-packages/MySQLdb/constants/__pycache__/FIELD_TYPE.cpython-310.opt-1.pyc from install of python3-mysqlclient-2.0.3-4.fc36.x86_64 conflicts with file from package python3-mysql-1.4.6-9.fc36.x86_64
  file /usr/lib64/python3.10/site-packages/MySQLdb/constants/__pycache__/FIELD_TYPE.cpython-310.pyc from install of python3-mysqlclient-2.0.3-4.fc36.x86_64 conflicts with file from package python3-mysql-1.4.6-9.fc36.x86_64
  file /usr/lib64/python3.10/site-packages/MySQLdb/constants/__pycache__/FLAG.cpython-310.opt-1.pyc from install of python3-mysqlclient-2.0.3-4.fc36.x86_64 conflicts with file from package python3-mysql-1.4.6-9.fc36.x86_64
  file /usr/lib64/python3.10/site-packages/MySQLdb/constants/__pycache__/FLAG.cpython-310.pyc from install of python3-mysqlclient-2.0.3-4.fc36.x86_64 conflicts with file from package python3-mysql-1.4.6-9.fc36.x86_64
  file /usr/lib64/python3.10/site-packages/MySQLdb/constants/__pycache__/__init__.cpython-310.opt-1.pyc from install of python3-mysqlclient-2.0.3-4.fc36.x86_64 conflicts with file from package python3-mysql-1.4.6-9.fc36.x86_64
  file /usr/lib64/python3.10/site-packages/MySQLdb/constants/__pycache__/__init__.cpython-310.pyc from install of python3-mysqlclient-2.0.3-4.fc36.x86_64 conflicts with file from package python3-mysql-1.4.6-9.fc36.x86_64
  file /usr/lib64/python3.10/site-packages/MySQLdb/converters.py from install of python3-mysqlclient-2.0.3-4.fc36.x86_64 conflicts with file from package python3-mysql-1.4.6-9.fc36.x86_64
  file /usr/lib64/python3.10/site-packages/MySQLdb/cursors.py from install of python3-mysqlclient-2.0.3-4.fc36.x86_64 conflicts with file from package python3-mysql-1.4.6-9.fc36.x86_64
  file /usr/lib64/python3.10/site-packages/MySQLdb/release.py from install of python3-mysqlclient-2.0.3-4.fc36.x86_64 conflicts with file from package python3-mysql-1.4.6-9.fc36.x86_64
  file /usr/lib64/python3.10/site-packages/MySQLdb/times.py from install of python3-mysqlclient-2.0.3-4.fc36.x86_64 conflicts with file from package python3-mysql-1.4.6-9.fc36.x86_64

See https://bugzilla.redhat.com/show_bug.cgi?id=2153769

The pip command can be risky if you are not careful. If if happens to override a module that is used by dnf, you may not be able to run dnf.

Thanks much I was wondering about that. I cannot break dnf, I will wait for a fix. Is there a place to look for the fix? Fedora, python, mythtv? where is ground zero? Thanks again

Sorry i see the link you sent looks like the root bug report I will monitor there

1 Like

I think that here you can find the explanation of the issue. Hopefully it will be resolved soon.

1 Like

Thanks. Wow this had been around a long time, Feb 2021. Doesn’t sound like it will get fixed soon. I will try and report it to mythtv too, maybe its in their wheelhouse.

Just to re-iterate from my previous response - Package conflicts can happen. As long as I’ve been using Fedora, I can’t think of a time where you could actually install every single package and not have a conflict.

If you could install both of these, one would overwrite the other and it would break your python library since they both provide the same python site-package (MySqlDb). dnf blocking this isn’t a bug but a feature! That said, the packages could be named to reflect different versions of the same driver rather than using different package names altogether.

If for some reason you need both versions of the driver, I suggest using pip with venv or container toolbox. Do not use pip outside of a venv/container context, especially as root, because you might overwrite rpm provided libraries and cause very bad things to happen. That said, running pip in a venv or container is perfectly sane.

For what it’s worth, I maintain Python server environments (JupyterHub) for a very large organization as part of my dayjob.

Here’s a fix from the good people at myth tv. HTH, thanks all I will open a bug at RPM Fusion also which is apparently root cause.

from Gary:
This is not a MythTV issue. It is an issue upstream (and should be closed accordingly). This was a result of the RPMFusion maintainer apparently changing requirements (and then apparently not testing the upgrade path) combined with the open upstream bug 1929101 – Retire "python-mysql" package in favor of "python-mysqlclient" PyPI package

You should, however, consider opening a RPMFusion bug to remind the maintainer of QA.

Instructions as to how to deal with the issue have been posted on the mythtv-users list.

From Mythtv users:
[mythtv-users] recent conflict python3-mysqlclient vs python3-mysql
Extract, from Chris:

I performed the ugprade using these commands in “dnf shell”:

remove python3-mysql
install python3-mysqlclient
upgrade
run

Bill - thanks for posting the feedback you got from the mythtv people! I have mythtv on the system where I experienced this problem that in turn led me to ask for help here.

Thanks also to everyone else who jumped into the discussion! I know that package conflicts are inevitable, but I’m glad that there are so many interested folks in the community that fixes and workarounds can nearly always be found.

Darron

2 Likes

Hi -

I’m hitting this while trying to upgrade from FC35 to FC37.

Does anyone know how to avoid the problem as part of the upgrade?

This:

dnf system-upgrade -y download --refresh --releasever=37

[ ... ]

The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'dnf clean packages'.
Error: Transaction test error:
  file /usr/lib64/python3.11/site-packages/MySQLdb/__init__.py conflicts between attempted installs of python3-mysql-1.4.6-11.fc37.x86_64 and python3-mysqlclient-2.1.0-3.fc37.x86_64
  file /usr/lib64/python3.11/site-packages/MySQLdb/__pycache__/__init__.cpython-311.opt-1.pyc conflicts between attempted installs of python3-mysql-1.4.6-11.fc37.x86_64 and python3-mysqlclient-2.1.0-3.fc37.x86_64
  file /usr/lib64/python3.11/site-packages/MySQLdb/__pycache__/__init__.cpython-311.pyc conflicts between attempted installs of python3-mysql-1.4.6-11.fc37.x86_64 and python3-mysqlclient-2.1.0-3.fc37.x86_64

[ ... ]

I do not think that both those packages are required and they do definitely have conflicts.

I think you could remove python3-mysql and it would eliminate the error while allowing python3-mysqlclient to be installed.

1 Like

According to @candelabra and the error reports python3-mysqlclient is a replacement for python3-mysql.

I have submitted updates that should fix this conflict. They are now pending, and should be in testing at the next compose.

Rawhide/F38: https://bodhi.fedoraproject.org/updates/FEDORA-2022-13aa6fbdb1
F37: https://bodhi.fedoraproject.org/updates/FEDORA-2022-713080ea38
F36: https://bodhi.fedoraproject.org/updates/FEDORA-2022-dbbe1b44c0

There may be some delay for it to get to stable as it will need to go through testing first.

1 Like