Bug #77819 mysql-connector-python 2.1.2 does not ship with required __init.py__ files
Submitted: 23 Jul 2015 20:09 Modified: 4 Aug 2015 17:21
Reporter: Otheus Shelling Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / Python Severity:S1 (Critical)
Version:2.1.2, 2.1.3 OS:Any
Assigned to: CPU Architecture:Any

[23 Jul 2015 20:09] Otheus Shelling
Description:
The shipped RPM packages do not include mysql/__init__.py{,c,o} files. This means that if the package replaces an existing installation, the utilities based on it will not work. Rather, they will see this error:

Traceback (most recent call last):
  File "/usr/bin/mysqlrplcheck", line 24, in <module>
    from mysql.utilities.common.tools import check_python_version
ImportError: No module named mysql.utilities.common.tools

It is unknown if this is a problem with the SPEC file or the Makefile or somewhere else.

See http://stackoverflow.com/questions/31593772/cannot-run-anything-from-mysql-utilities-no-mo...

How to repeat:
rpm / yum install of the 2.1.2 version of mysql-connector-python. Run any program packaged with the mysql-utilities suite.
[24 Jul 2015 8:58] Peeyush Gupta
Try uninstalling all the older versions of MySQL utilities and Connector/Python and install the latest GA versions of both. 
Can you tell us what was the upgrade procedure you followed, i.e. which versions to which version ?
[24 Jul 2015 12:12] Geert Vanderkelen
This is not an easy thing to fix in RPM packages.

This is an old topic, so let me give some background and clear this up.

The MySQL namespace is used for different projects: MySQL Connector/Python, MySQL Utilities and MySQL Fabric. Every package needs mysql/__init__.py and it will install it.

One can argue that Utilities and Fabric are dependent on C/Python, so those shall not need to install mysql/__init__.py. But what if another package needs to be installed in the mysql namespace not dependent on Connector/Python?

RPM will have and has problems handling `mysql/__init__.py` which is delivered by multiple packages. So, that's why I came up with that (crazy) hack removing it and making part of post install. This way, it's like __init__.py is not installed, so there is no reason to complain. There was lots of frustration doing this, long time ago..

One of the effects is that each of the packages installing in the MySQL namespace needs to have system in-place with remove and post-install (and also post remove).

For now, the RPM will work given that you don't do anything special (so it will work for most people). This is not good, I know.

The only solution is an extra RPM package with only this mysql/__init__.py and all others depend on it. I believe the distributions packagers are already doing this. It's just that it is not fun downloading an extra package..

I do believe, however, that this should be an S2 instead of S1. We had this post-install since pretty much day 1 of Connector/Python.
[24 Jul 2015 12:19] Otheus Shelling
@Vanderkelen I'm glad you're on the ball on this one. 

> For now, the RPM will work given that you don't do anything special (so it will work for most people). This is not good, I know.

I cannot agree with this. Like I said, the install with 2.0.x works just fine, but not with the 2.1.x. So I suggest there was a change to how the packages were made or generated. 

To be clear, I first had 1.1 installed. Then I upgraded the utilities to 1.5, which complained my connector was too old. So I upgraded to 2.1.2, which I believe is the most recent. (If it is not, please tell me where I can find a newer version). The 2.1.2 version does not work. When RPM upgrades, it first completely removes 1.1, then installs 2.1.2. 

To get things to work -- I removed 2.1.2 and installed 2.0.x. 

So something changed. Was it a feature or a bug that these files were removed?
[26 Jul 2015 7:11] MySQL Verification Team
Hello Otheus Shelling,

Thank you for the bug report and feedback.
Observed this while upgrading from 2.0.4 to 2.1.3

//

[root@cluster-repo ~]# ll *.rpm
-rw-r--r-- 1 root root 255948 Jul 16 06:22 15927036.mysql-connector-python-2.1.3-1.el6.noarch.rpm
-rw-r--r-- 1 root root 220576 Apr  1 04:54 mysql-connector-python-2.0.4-1.el6.noarch.rpm
[root@cluster-repo ~]# rpm -ivh mysql-connector-python-2.0.4-1.el6.noarch.rpm
Preparing...                ########################################### [100%]
   1:mysql-connector-python ########################################### [100%]
[root@cluster-repo ~]#
[root@cluster-repo ~]# rpm -qa|grep mysql-connector
mysql-connector-python-2.0.4-1.el6.noarch
[root@cluster-repo ~]#
[root@cluster-repo ~]# mysqldbcompare --server1=root@localhost --server2=root@localhost db1:db2
# server1 on localhost: ... connected.
# server2 on localhost: ... connected.
ERROR: The database db1 does not exist.
[root@cluster-repo ~]#
[root@cluster-repo ~]# rpm -Uvh 15927036.mysql-connector-python-2.1.3-1.el6.noarch.rpm
Preparing...                ########################################### [100%]
   1:mysql-connector-python ########################################### [100%]
[root@cluster-repo ~]#
[root@cluster-repo ~]# mysqldbcompare --server1=root@localhost --server2=root@localhost db1:db2
Traceback (most recent call last):
  File "/usr/bin/mysqldbcompare", line 24, in <module>
    from mysql.utilities.common.tools import check_python_version
ImportError: No module named mysql.utilities.common.tools

Thanks,
Umesh
[4 Aug 2015 17:21] Paul DuBois
Noted in 2.1.3 changelog.

RPM packages of Connector/Python were missing some required
__init_py__ files.