MySQLdb for 3.6 on RHEL7
On Tue, Aug 13, 2019 at 2:16 PM Chris Angelico <rosuav at gmail.com> wrote:
> On Wed, Aug 14, 2019 at 1:48 AM Larry Martell <larry.martell at gmail.com> wrote:
> > On Tue, Aug 13, 2019 at 9:59 AM Chris Angelico <rosuav at gmail.com> wrote:
> > >
> > > On Tue, Aug 13, 2019 at 11:33 PM Larry Martell <larry.martell at gmail.com> wrote:
> > > >
> > > > I am trying to install MySQLdb (https://pypi.org/project/mysqlclient/)
> > > > for python3.6 on RHEL7.
> > > >
> > > > When I import it, it fails:
> > > >
> > > > # python3.6
> > > > Python 3.6.8 (default, Jun 11 2019, 15:15:01)
> > > > [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
> > > > Type "help", "copyright", "credits" or "license" for more information.
> > > > >>> import MySQLdb
> > > > Traceback (most recent call last):
> > > > File "<stdin>", line 1, in <module>
> > > > File "/usr/local/lib64/python3.6/site-packages/mysqlclient-1.4.4-py3.6-linux-x86_64.egg/MySQLdb/__init__.py",
> > > > line 18, in <module>
> > > > from . import _mysql
> > > > ImportError: /usr/local/lib64/python3.6/site-packages/mysqlclient-1.4.4-py3.6-linux-x86_64.egg/MySQLdb/_mysql.cpython-36m-x86_64-linux-gnu.so:
> > > > undefined symbol: mysql_kill
> > > >
> > > > Has anyone seen and resolved this?
> > >
> > > Not specifically, but that looks like a versioning conflict. Most
> > > likely, your mysqlclient is too old for MySQLdb to connect to.
> > >
> > > Did you get one of them from your system package manager and the other
> > > from pip? If so, try to get both from the same place.
> > So I have MySQL from the system package manager, but mysqlclient is
> > not available there.
> That seems very odd. The mysqlclient binary might be just under a
> different name? I'm not familiar with RHEL, but on my Debian, there
> are packages like "mysql-server-5.7" and corresponding
> "mysql-client-5.7". Or do you mean the Python client?
Yes, the python client, which is called mysqlclient but imported as
> > And I was not able to get that from pip either,
> > as the install failed. I had to download the source, edit the site.cfg
> > file and build it. But I just found python36-mysql.x86_64 as a package
> > so I uninstalled mysqlclient and installed that from the repo.
The reason that would not install from pip was because the path to
mysql_config was not correct in site.cfg - once I changed that I was
able to build it, but then it gave the other error.
> Based on this, I'm thinking possibly you meant the Python client. It
> may still be that you need to install the C client for the Python one
> to connect to. Although.... if you got python36-mysql from your system
> repo, that ought to drag in the appropriate mysqlclient. So now I'm
> very confused.
> > That did not get the above error, but now I get this:
> > raise ImproperlyConfigured('mysqlclient 1.3.13 or newer is
> > required; you have %s.' % Database.__version__)
> > django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or
> > newer is required; you have 1.3.12.
> This claims to be a Django error, though, so maybe the issue here
> isn't with MySQLdb but with Django?? Maybe everything up above is
> actually correctly matched, but too old?
I got around that by changing the code in django to not require that version.