Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-13208

Cannot import libmariadbclient.so.18 from python

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.1.23
    • 10.1.27
    • Platform Debian
    • None
    • Debian Stretch

    Description

      Hi!

      I have some problems with MariaDB 10.1 (from your repositories). I can't use the python MySQLDb lib.

      I don't have any problems on Jessie (Debian or MariaDB repo) or Stretch (Debian repo).

      root@4cd9031401a8:/home/vagrant# dpkg -l | grep mariadb
      ii  libmariadb-dev              2.3.2-2                        amd64        MariaDB Connector/C, development files
      ii  libmariadb2:amd64           2.3.2-2                        amd64        MariaDB Connector/C
      ii  libmariadbclient18          10.1.23+maria-1~stretch        amd64        MariaDB database client library
      ii  mariadb-client-10.1         10.1.23+maria-1~stretch        amd64        MariaDB database client binaries
      ii  mariadb-client-core-10.1    10.1.23+maria-1~stretch        amd64        MariaDB database core client binaries
      ii  mariadb-common              10.1.23+maria-1~stretch        all          MariaDB database common files (e.g. /etc/mysql/conf.d/mariadb.cnf)
      ii  mariadb-server              10.1.23+maria-1~stretch        all          MariaDB database server (metapackage depending on the latest version)
      ii  mariadb-server-10.1         10.1.23+maria-1~stretch        amd64        MariaDB database server binaries
      ii  mariadb-server-core-10.1    10.1.23+maria-1~stretch        amd64        MariaDB database core server files
       
      root@4cd9031401a8:/home/vagrant# apt-cache policy python-mysqldb
      python-mysqldb:
        Installed: 1.3.7-1.1
        Candidate: 1.3.7-1.1
        Version table:
       *** 1.3.7-1.1 500
              500 http://deb.debian.org/debian stretch/main amd64 Packages
              100 /var/lib/dpkg/status
       
       
       
      root@4cd9031401a8:/home/vagrant# mysql --version
      mysql  Ver 15.1 Distrib 10.1.23-MariaDB, for debian-linux-gnu (x86_64) using readline 5.
       
      root@4cd9031401a8:/home/vagrant# apt-cache policy mariadb-common
      mariadb-common:
        Installed: 10.1.23+maria-1~stretch
        Candidate: 10.1.23+maria-1~stretch
        Version table:
       *** 10.1.23+maria-1~stretch 500
              500 http://ftp.igh.cnrs.fr/pub/mariadb/repo/10.1/debian stretch/main amd64 Packages
              100 /var/lib/dpkg/status
           10.1.23-9+deb9u1 500
              500 http://deb.debian.org/debian stretch/main amd64 Packages
       
       
      root@4cd9031401a8:/home/vagrant# lsb_release -av
      No LSB modules are available.
      Distributor ID:	Debian
      Description:	Debian GNU/Linux 9.0 (stretch)
      Release:	9.0
      Codename:	stretch
       
       
      root@4cd9031401a8:/home/vagrant# python -c "import MySQLdb"
      Traceback (most recent call last):
        File "<string>", line 1, in <module>
        File "/usr/lib/python2.7/dist-packages/MySQLdb/__init__.py", line 19, in <module>
          import _mysql
      ImportError: libmariadbclient.so.18: cannot open shared object file: No such file or directory
      
      

      We can bypass the problem by importing latest version of the lib with pip.

      root@4cd9031401a8:/home/vagrant# python
      Python 2.7.13 (default, Jan 19 2017, 14:48:08) 
      [GCC 6.3.0 20170118] on linux2
      Type "help", "copyright", "credits" or "license" for more information.
      >>> import MySQLdb
      >>> print MySQLdb.__version__
      1.3.10
      
      

      Cheers!

      Emilien

      Attachments

        Issue Links

          Activity

            hanx Emilien Mantel created issue -

            You're using MySQLdb from stretch, and our 10.1 packages.

            Debian renamed the client library to libmariadbclient.so. And MySQLdb was built with that.

            Our 10.1 packages still use libmysqlclient, they provide libmysqlclient.so, our 10.2 packages come with MariaDB Connector/C and provide libmariadb.so (with symlinks to libmysqlclient.so).

            Now we need to build our packages to be compatible with stretch. This means libmariadbclient.so symlink and libmariadbclient_18 version nodes...

            serg Sergei Golubchik added a comment - You're using MySQLdb from stretch, and our 10.1 packages. Debian renamed the client library to libmariadbclient.so. And MySQLdb was built with that. Our 10.1 packages still use libmysqlclient, they provide libmysqlclient.so, our 10.2 packages come with MariaDB Connector/C and provide libmariadb.so (with symlinks to libmysqlclient.so). Now we need to build our packages to be compatible with stretch. This means libmariadbclient.so symlink and libmariadbclient_18 version nodes...
            serg Sergei Golubchik made changes -
            Field Original Value New Value
            Status Open [ 1 ] Confirmed [ 10101 ]
            hanx Emilien Mantel made changes -
            Description Hi!

            I have some problems with MariaDB 10.1 (from your repositories). I can't use the python MySQLDb lib.

            I don't have any problems on Jessie (Debian or MariaDB repo) or Stretch (Debian repo).

            {noformat}
            root@4cd9031401a8:/home/vagrant# dpkg -l | grep mariadb
            ii libmariadb-dev 2.3.2-2 amd64 MariaDB Connector/C, development files
            ii libmariadb2:amd64 2.3.2-2 amd64 MariaDB Connector/C
            ii libmariadbclient18 10.1.23+maria-1~stretch amd64 MariaDB database client library
            ii mariadb-client-10.1 10.1.23+maria-1~stretch amd64 MariaDB database client binaries
            ii mariadb-client-core-10.1 10.1.23+maria-1~stretch amd64 MariaDB database core client binaries
            ii mariadb-common 10.1.23+maria-1~stretch all MariaDB database common files (e.g. /etc/mysql/conf.d/mariadb.cnf)
            ii mariadb-server 10.1.23+maria-1~stretch all MariaDB database server (metapackage depending on the latest version)
            ii mariadb-server-10.1 10.1.23+maria-1~stretch amd64 MariaDB database server binaries
            ii mariadb-server-core-10.1 10.1.23+maria-1~stretch amd64 MariaDB database core server files

            root@4cd9031401a8:/home/vagrant# apt-cache policy python-mysqldb
            python-mysqldb:
              Installed: 1.3.7-1.1
              Candidate: 1.3.7-1.1
              Version table:
             *** 1.3.7-1.1 500
                    500 http://deb.debian.org/debian stretch/main amd64 Packages
                    100 /var/lib/dpkg/status



            root@4cd9031401a8:/home/vagrant# mysql --version
            mysql Ver 15.1 Distrib 10.1.23-MariaDB, for debian-linux-gnu (x86_64) using readline 5.

            root@4cd9031401a8:/home/vagrant# apt-cache policy mariadb-common
            mariadb-common:
              Installed: 10.1.23+maria-1~stretch
              Candidate: 10.1.23+maria-1~stretch
              Version table:
             *** 10.1.23+maria-1~stretch 500
                    500 http://ftp.igh.cnrs.fr/pub/mariadb/repo/10.1/debian stretch/main amd64 Packages
                    100 /var/lib/dpkg/status
                 10.1.23-9+deb9u1 500
                    500 http://deb.debian.org/debian stretch/main amd64 Packages


            root@4cd9031401a8:/home/vagrant# lsb_release -av
            No LSB modules are available.
            Distributor ID: Debian
            Description: Debian GNU/Linux 9.0 (stretch)
            Release: 9.0
            Codename: stretch


            root@4cd9031401a8:/home/vagrant# python -c "import MySQLdb"
            Traceback (most recent call last):
              File "<string>", line 1, in <module>
              File "/usr/lib/python2.7/dist-packages/MySQLdb/__init__.py", line 19, in <module>
                import _mysql
            ImportError: libmariadbclient.so.18: cannot open shared object file: No such file or directory

            {noformat}

            We can bypass the problem by importing latest version of the lib with pip.

            {noformat}
            root@4cd9031401a8:/home/vagrant# python
            Python 2.7.13 (default, Jan 19 2017, 14:48:08)
            [GCC 6.3.0 20170118] on linux2
            Type "help", "copyright", "credits" or "license" for more information.
            >>> import MySQLdb
            AttributeError: 'module' object has no attribute 'version'
            >>> print MySQLdb.__version__
            1.3.10

            {noformat}

            Cheers!

            Emilien
            Hi!

            I have some problems with MariaDB 10.1 (from your repositories). I can't use the python MySQLDb lib.

            I don't have any problems on Jessie (Debian or MariaDB repo) or Stretch (Debian repo).

            {noformat}
            root@4cd9031401a8:/home/vagrant# dpkg -l | grep mariadb
            ii libmariadb-dev 2.3.2-2 amd64 MariaDB Connector/C, development files
            ii libmariadb2:amd64 2.3.2-2 amd64 MariaDB Connector/C
            ii libmariadbclient18 10.1.23+maria-1~stretch amd64 MariaDB database client library
            ii mariadb-client-10.1 10.1.23+maria-1~stretch amd64 MariaDB database client binaries
            ii mariadb-client-core-10.1 10.1.23+maria-1~stretch amd64 MariaDB database core client binaries
            ii mariadb-common 10.1.23+maria-1~stretch all MariaDB database common files (e.g. /etc/mysql/conf.d/mariadb.cnf)
            ii mariadb-server 10.1.23+maria-1~stretch all MariaDB database server (metapackage depending on the latest version)
            ii mariadb-server-10.1 10.1.23+maria-1~stretch amd64 MariaDB database server binaries
            ii mariadb-server-core-10.1 10.1.23+maria-1~stretch amd64 MariaDB database core server files

            root@4cd9031401a8:/home/vagrant# apt-cache policy python-mysqldb
            python-mysqldb:
              Installed: 1.3.7-1.1
              Candidate: 1.3.7-1.1
              Version table:
             *** 1.3.7-1.1 500
                    500 http://deb.debian.org/debian stretch/main amd64 Packages
                    100 /var/lib/dpkg/status



            root@4cd9031401a8:/home/vagrant# mysql --version
            mysql Ver 15.1 Distrib 10.1.23-MariaDB, for debian-linux-gnu (x86_64) using readline 5.

            root@4cd9031401a8:/home/vagrant# apt-cache policy mariadb-common
            mariadb-common:
              Installed: 10.1.23+maria-1~stretch
              Candidate: 10.1.23+maria-1~stretch
              Version table:
             *** 10.1.23+maria-1~stretch 500
                    500 http://ftp.igh.cnrs.fr/pub/mariadb/repo/10.1/debian stretch/main amd64 Packages
                    100 /var/lib/dpkg/status
                 10.1.23-9+deb9u1 500
                    500 http://deb.debian.org/debian stretch/main amd64 Packages


            root@4cd9031401a8:/home/vagrant# lsb_release -av
            No LSB modules are available.
            Distributor ID: Debian
            Description: Debian GNU/Linux 9.0 (stretch)
            Release: 9.0
            Codename: stretch


            root@4cd9031401a8:/home/vagrant# python -c "import MySQLdb"
            Traceback (most recent call last):
              File "<string>", line 1, in <module>
              File "/usr/lib/python2.7/dist-packages/MySQLdb/__init__.py", line 19, in <module>
                import _mysql
            ImportError: libmariadbclient.so.18: cannot open shared object file: No such file or directory

            {noformat}

            We can bypass the problem by importing latest version of the lib with pip.

            {noformat}
            root@4cd9031401a8:/home/vagrant# python
            Python 2.7.13 (default, Jan 19 2017, 14:48:08)
            [GCC 6.3.0 20170118] on linux2
            Type "help", "copyright", "credits" or "license" for more information.
            >>> import MySQLdb
            >>> print MySQLdb.__version__
            1.3.10

            {noformat}

            Cheers!

            Emilien
            serg Sergei Golubchik made changes -
            Status Confirmed [ 10101 ] Open [ 1 ]
            serg Sergei Golubchik made changes -
            Status Open [ 1 ] Confirmed [ 10101 ]
            serg Sergei Golubchik made changes -
            Status Confirmed [ 10101 ] Open [ 1 ]
            serg Sergei Golubchik made changes -
            Component/s libmariadb [ 14006 ]
            serg Sergei Golubchik made changes -
            Status Open [ 1 ] Confirmed [ 10101 ]
            nielsh Niels Hendriks added a comment - - edited

            Hi,

            I'm having a similar issue, though not exactly the same.

            I'm using Debian 8 with MariaDB 10.2 and I see the following error:

            python -c "import MySQLdb"
            Traceback (most recent call last):
              File "<string>", line 1, in <module>
              File "/usr/lib/python2.7/dist-packages/MySQLdb/__init__.py", line 19, in <module>
                import _mysql
            ImportError: libmysqlclient.so.18: cannot open shared object file: No such file or directory
            

            I have the following package installed:

            ii  libmysqlclient18               10.2.6+maria~jessie                                               amd64        Virtual package to satisfy external depends
            

            I can see with a strace it is trying to access this file: /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18 - this file does exist, but it is a symlink:

            lrwxrwxrwx 1 root root 26 Jun 30 09:45 /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18 -> libmysqlclient_r.so.18.0.0
            

            However, libmysqlclient_r.so.18.0.0 does not exist, so it is a broken symlink:

            file /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18
            /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18: broken symbolic link to libmysqlclient_r.so.18.0.0
            

            As far as I can see, there is a libmariadbclient-dev package supplied by the MariaDB 10.2 repo, but this does not include the libmysqlclient libraries, only the libmariadbclient libraries.
            There is also a libmysqlclient-dev package but it is supplied by the Debian repo and not the MariaDB repo. This package has MySQL 5.5 dependencies so it cannot be installed together with mariadb.

            I have the following python-mysqldb version:

            apt-cache policy python-mysqldb
            python-mysqldb:
              Installed: 1.2.3-2.1
              Candidate: 1.2.3-2.1
              Version table:
             *** 1.2.3-2.1 0
                    500 http://ftp.nl.debian.org/debian/ jessie/main amd64 Packages
                    100 /var/lib/dpkg/status
            

            nielsh Niels Hendriks added a comment - - edited Hi, I'm having a similar issue, though not exactly the same. I'm using Debian 8 with MariaDB 10.2 and I see the following error: python -c "import MySQLdb" Traceback (most recent call last): File "<string>", line 1, in <module> File "/usr/lib/python2.7/dist-packages/MySQLdb/__init__.py", line 19, in <module> import _mysql ImportError: libmysqlclient.so.18: cannot open shared object file: No such file or directory I have the following package installed: ii libmysqlclient18 10.2.6+maria~jessie amd64 Virtual package to satisfy external depends I can see with a strace it is trying to access this file: /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18 - this file does exist, but it is a symlink: lrwxrwxrwx 1 root root 26 Jun 30 09:45 /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18 -> libmysqlclient_r.so.18.0.0 However, libmysqlclient_r.so.18.0.0 does not exist, so it is a broken symlink: file /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18 /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18: broken symbolic link to libmysqlclient_r.so.18.0.0 As far as I can see, there is a libmariadbclient-dev package supplied by the MariaDB 10.2 repo, but this does not include the libmysqlclient libraries, only the libmariadbclient libraries. There is also a libmysqlclient-dev package but it is supplied by the Debian repo and not the MariaDB repo. This package has MySQL 5.5 dependencies so it cannot be installed together with mariadb. I have the following python-mysqldb version: apt-cache policy python-mysqldb python-mysqldb: Installed: 1.2.3-2.1 Candidate: 1.2.3-2.1 Version table: *** 1.2.3-2.1 0 500 http://ftp.nl.debian.org/debian/ jessie/main amd64 Packages 100 /var/lib/dpkg/status
            serg Sergei Golubchik made changes -
            serg Sergei Golubchik made changes -

            nielsh, your issue is different. This one is about 10.1, that does not have libmariadbclient.so.

            Yours is about 10.2 that does not have libmysqlclient.so. This looks more like MDEV-12423 and MDEV-12889

            serg Sergei Golubchik added a comment - nielsh , your issue is different. This one is about 10.1, that does not have libmariadbclient.so. Yours is about 10.2 that does not have libmysqlclient.so. This looks more like MDEV-12423 and MDEV-12889
            elenst Elena Stepanova made changes -
            Fix Version/s 10.1 [ 16100 ]
            Assignee Sergei Golubchik [ serg ]
            serg Sergei Golubchik made changes -
            Status Confirmed [ 10101 ] In Progress [ 3 ]
            serg Sergei Golubchik made changes -
            Status In Progress [ 3 ] Stalled [ 10000 ]
            serg Sergei Golubchik made changes -
            Fix Version/s 10.1.27 [ 22609 ]
            Fix Version/s 10.1 [ 16100 ]
            Resolution Fixed [ 1 ]
            Status Stalled [ 10000 ] Closed [ 6 ]
            serg Sergei Golubchik made changes -
            Resolution Fixed [ 1 ]
            Status Closed [ 6 ] Stalled [ 10000 ]
            serg Sergei Golubchik made changes -
            Fix Version/s 10.1 [ 16100 ]
            Fix Version/s 10.1.27 [ 22609 ]

            Added symlinks, but not version nodes. Reopened, sorry

            serg Sergei Golubchik added a comment - Added symlinks, but not version nodes. Reopened, sorry
            serg Sergei Golubchik made changes -
            Fix Version/s 10.1.27 [ 22609 ]
            Fix Version/s 10.1 [ 16100 ]
            Resolution Fixed [ 1 ]
            Status Stalled [ 10000 ] Closed [ 6 ]
            otto Otto Kekäläinen added a comment - - edited

            Related to this, in Debian packaging we test on every commit that this Python module compiles and works:

            }}
             
            # Build a piece of software that was designed bot libmysqlclient-dev using the
            # libmariadb-dev-compat layer. Should always end up using libmariadb.so.3 run-time
            test build Python-MySQLdb with mariadbclient:
              stage: test quality
              image: debian:sid
              script:
                - cd ${WORKING_DIR} # Don't repeat this step, it's just cd ./debian/output
                - mkdir debug
                - apt-get update
                - apt-get install -y pkg-config ./libmariadb-dev*.deb ./libmariadb3_*.deb ./mariadb-common*.deb
                - pkg-config --cflags --libs mysqlclient # See what MySQLdb builds with
                - apt-get install -y python3-pip
                - pip3 install mysqlclient # Compiles module against libmysqlclient
                - apt-get purge -y libmariadb-dev # Not needed for run-time
                - python3 -c "import MySQLdb; print(MySQLdb.get_client_info())"
             
            {{

            Upstream mariadb client libs packaging has a bunch of shortcomings which I think most of are now fixed in the Debian version of MariaDB 10.3 (example: https://salsa.debian.org/mariadb-team/mariadb-10.3/commit/a02149c83bdbeab391ab331b34f28b2bf8352728) and I indend to upstream these into 10.4 (current development branch) this week.

            otto Otto Kekäläinen added a comment - - edited Related to this, in Debian packaging we test on every commit that this Python module compiles and works: }}   # Build a piece of software that was designed bot libmysqlclient-dev using the # libmariadb-dev-compat layer. Should always end up using libmariadb.so.3 run-time test build Python-MySQLdb with mariadbclient: stage: test quality image: debian:sid script: - cd ${WORKING_DIR} # Don't repeat this step, it's just cd ./debian/output - mkdir debug - apt-get update - apt-get install -y pkg-config ./libmariadb-dev*.deb ./libmariadb3_*.deb ./mariadb-common*.deb - pkg-config --cflags --libs mysqlclient # See what MySQLdb builds with - apt-get install -y python3-pip - pip3 install mysqlclient # Compiles module against libmysqlclient - apt-get purge -y libmariadb-dev # Not needed for run-time - python3 -c "import MySQLdb; print(MySQLdb.get_client_info())"   {{ Upstream mariadb client libs packaging has a bunch of shortcomings which I think most of are now fixed in the Debian version of MariaDB 10.3 (example: https://salsa.debian.org/mariadb-team/mariadb-10.3/commit/a02149c83bdbeab391ab331b34f28b2bf8352728 ) and I indend to upstream these into 10.4 (current development branch) this week.
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 81454 ] MariaDB v4 [ 152406 ]

            People

              serg Sergei Golubchik
              hanx Emilien Mantel
              Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.