skip to Main Content

I am trying to install mariadb usin pip3 on a python 3.8 environment on a Ubuntu 2004 server.

I did download the mariadb-connector-c (version 3.31) and copied the files to their destinations.

I also installed python2-dev and its dependencies on the systems.

The error I do receive when I launch "pip3 install mariadb" is:

Collecting mariadb
  Using cached mariadb-1.1.3.tar.gz (80 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: mariadb
  Building wheel for mariadb (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [47 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-38
      creating build/lib.linux-x86_64-cpython-38/mariadb
      copying mariadb/__init__.py -> build/lib.linux-x86_64-cpython-38/mariadb
      creating build/lib.linux-x86_64-cpython-38/mariadb/constants
      copying mariadb/constants/__init__.py -> build/lib.linux-x86_64-cpython-38/mariadb/constants
      copying mariadb/constants/CLIENT.py -> build/lib.linux-x86_64-cpython-38/mariadb/constants
      copying mariadb/constants/CURSOR.py -> build/lib.linux-x86_64-cpython-38/mariadb/constants
      copying mariadb/constants/STATUS.py -> build/lib.linux-x86_64-cpython-38/mariadb/constants
      copying mariadb/constants/TPC_STATE.py -> build/lib.linux-x86_64-cpython-38/mariadb/constants
      copying mariadb/constants/INFO.py -> build/lib.linux-x86_64-cpython-38/mariadb/constants
      copying mariadb/field.py -> build/lib.linux-x86_64-cpython-38/mariadb
      copying mariadb/connections.py -> build/lib.linux-x86_64-cpython-38/mariadb
      copying mariadb/connectionpool.py -> build/lib.linux-x86_64-cpython-38/mariadb
      copying mariadb/dbapi20.py -> build/lib.linux-x86_64-cpython-38/mariadb
      copying mariadb/cursors.py -> build/lib.linux-x86_64-cpython-38/mariadb
      copying mariadb/release_info.py -> build/lib.linux-x86_64-cpython-38/mariadb
      copying mariadb/constants/ERR.py -> build/lib.linux-x86_64-cpython-38/mariadb/constants
      copying mariadb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-cpython-38/mariadb/constants
      copying mariadb/constants/FIELD_FLAG.py -> build/lib.linux-x86_64-cpython-38/mariadb/constants
      copying mariadb/constants/INDICATOR.py -> build/lib.linux-x86_64-cpython-38/mariadb/constants
      running build_ext
      building 'mariadb._mariadb' extension
      creating build/temp.linux-x86_64-cpython-38
      creating build/temp.linux-x86_64-cpython-38/mariadb
      x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -DPY_MARIADB_MAJOR_VERSION=1 -DPY_MARIADB_MINOR_VERSION=1 -DPY_MARIADB_PATCH_VERSION=3 -DPY_MARIADB_PRE_RELEASE_SEGMENT="" -I/usr/include/mariadb -I/usr/include/mariadb/mysql -I./include -I/var/sas/scrap_venv/include -I/usr/include/python3.8 -c mariadb/mariadb.c -o build/temp.linux-x86_64-cpython-38/mariadb/mariadb.o -DDEFAULT_PLUGINS_SUBDIR="/usr/lib/mariadb/plugin"
      x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -DPY_MARIADB_MAJOR_VERSION=1 -DPY_MARIADB_MINOR_VERSION=1 -DPY_MARIADB_PATCH_VERSION=3 -DPY_MARIADB_PRE_RELEASE_SEGMENT="" -I/usr/include/mariadb -I/usr/include/mariadb/mysql -I./include -I/var/sas/scrap_venv/include -I/usr/include/python3.8 -c mariadb/mariadb_codecs.c -o build/temp.linux-x86_64-cpython-38/mariadb/mariadb_codecs.o -DDEFAULT_PLUGINS_SUBDIR="/usr/lib/mariadb/plugin"
      x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -DPY_MARIADB_MAJOR_VERSION=1 -DPY_MARIADB_MINOR_VERSION=1 -DPY_MARIADB_PATCH_VERSION=3 -DPY_MARIADB_PRE_RELEASE_SEGMENT="" -I/usr/include/mariadb -I/usr/include/mariadb/mysql -I./include -I/var/sas/scrap_venv/include -I/usr/include/python3.8 -c mariadb/mariadb_connection.c -o build/temp.linux-x86_64-cpython-38/mariadb/mariadb_connection.o -DDEFAULT_PLUGINS_SUBDIR="/usr/lib/mariadb/plugin"
      x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -DPY_MARIADB_MAJOR_VERSION=1 -DPY_MARIADB_MINOR_VERSION=1 -DPY_MARIADB_PATCH_VERSION=3 -DPY_MARIADB_PRE_RELEASE_SEGMENT="" -I/usr/include/mariadb -I/usr/include/mariadb/mysql -I./include -I/var/sas/scrap_venv/include -I/usr/include/python3.8 -c mariadb/mariadb_cursor.c -o build/temp.linux-x86_64-cpython-38/mariadb/mariadb_cursor.o -DDEFAULT_PLUGINS_SUBDIR="/usr/lib/mariadb/plugin"
      mariadb/mariadb_cursor.c: In function ‘MrdbCursor_execute_binary’:
      mariadb/mariadb_cursor.c:1094:48: error: ‘const struct st_mariadb_methods’ has no member named ‘db_execute_generate_request’
       1094 |     if (!(buf= self->connection->mysql->methods->db_execute_generate_request(self->stmt, &buflen, 1)))
            |                                                ^~
      mariadb/mariadb_cursor.c:1058:20: warning: variable ‘buf’ set but not used [-Wunused-but-set-variable]
       1058 |     unsigned char *buf= NULL;
            |                    ^~~
      mariadb/mariadb_cursor.c: In function ‘MrdbCursor_execute_bulk’:
      mariadb/mariadb_cursor.c:1205:48: error: ‘const struct st_mariadb_methods’ has no member named ‘db_execute_generate_request’
       1205 |     if (!(buf= self->connection->mysql->methods->db_execute_generate_request(self->stmt, &buflen, 1)))
            |                                                ^~
      mariadb/mariadb_cursor.c:1169:20: warning: variable ‘buf’ set but not used [-Wunused-but-set-variable]
       1169 |     unsigned char *buf= NULL;
            |                    ^~~
      error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for mariadb
  Running setup.py clean for mariadb
Failed to build mariadb
Installing collected packages: mariadb
  Running setup.py install for mariadb ... error
  error: subprocess-exited-with-error

  × Running setup.py install for mariadb did not run successfully.
  │ exit code: 1
  ╰─> [49 lines of output]
      running install
      /var/sas/scrap_venv/lib/python3.8/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-38
      creating build/lib.linux-x86_64-cpython-38/mariadb
      copying mariadb/__init__.py -> build/lib.linux-x86_64-cpython-38/mariadb
      creating build/lib.linux-x86_64-cpython-38/mariadb/constants
      copying mariadb/constants/__init__.py -> build/lib.linux-x86_64-cpython-38/mariadb/constants
      copying mariadb/constants/CLIENT.py -> build/lib.linux-x86_64-cpython-38/mariadb/constants
      copying mariadb/constants/CURSOR.py -> build/lib.linux-x86_64-cpython-38/mariadb/constants
      copying mariadb/constants/STATUS.py -> build/lib.linux-x86_64-cpython-38/mariadb/constants
      copying mariadb/constants/TPC_STATE.py -> build/lib.linux-x86_64-cpython-38/mariadb/constants
      copying mariadb/constants/INFO.py -> build/lib.linux-x86_64-cpython-38/mariadb/constants
      copying mariadb/field.py -> build/lib.linux-x86_64-cpython-38/mariadb
      copying mariadb/connections.py -> build/lib.linux-x86_64-cpython-38/mariadb
      copying mariadb/connectionpool.py -> build/lib.linux-x86_64-cpython-38/mariadb
      copying mariadb/dbapi20.py -> build/lib.linux-x86_64-cpython-38/mariadb
      copying mariadb/cursors.py -> build/lib.linux-x86_64-cpython-38/mariadb
      copying mariadb/release_info.py -> build/lib.linux-x86_64-cpython-38/mariadb
      copying mariadb/constants/ERR.py -> build/lib.linux-x86_64-cpython-38/mariadb/constants
      copying mariadb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-cpython-38/mariadb/constants
      copying mariadb/constants/FIELD_FLAG.py -> build/lib.linux-x86_64-cpython-38/mariadb/constants
      copying mariadb/constants/INDICATOR.py -> build/lib.linux-x86_64-cpython-38/mariadb/constants
      running build_ext
      building 'mariadb._mariadb' extension
      creating build/temp.linux-x86_64-cpython-38
      creating build/temp.linux-x86_64-cpython-38/mariadb
      x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -DPY_MARIADB_MAJOR_VERSION=1 -DPY_MARIADB_MINOR_VERSION=1 -DPY_MARIADB_PATCH_VERSION=3 -DPY_MARIADB_PRE_RELEASE_SEGMENT="" -I/usr/include/mariadb -I/usr/include/mariadb/mysql -I./include -I/var/sas/scrap_venv/include -I/usr/include/python3.8 -c mariadb/mariadb.c -o build/temp.linux-x86_64-cpython-38/mariadb/mariadb.o -DDEFAULT_PLUGINS_SUBDIR="/usr/lib/mariadb/plugin"
      x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -DPY_MARIADB_MAJOR_VERSION=1 -DPY_MARIADB_MINOR_VERSION=1 -DPY_MARIADB_PATCH_VERSION=3 -DPY_MARIADB_PRE_RELEASE_SEGMENT="" -I/usr/include/mariadb -I/usr/include/mariadb/mysql -I./include -I/var/sas/scrap_venv/include -I/usr/include/python3.8 -c mariadb/mariadb_codecs.c -o build/temp.linux-x86_64-cpython-38/mariadb/mariadb_codecs.o -DDEFAULT_PLUGINS_SUBDIR="/usr/lib/mariadb/plugin"
      x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -DPY_MARIADB_MAJOR_VERSION=1 -DPY_MARIADB_MINOR_VERSION=1 -DPY_MARIADB_PATCH_VERSION=3 -DPY_MARIADB_PRE_RELEASE_SEGMENT="" -I/usr/include/mariadb -I/usr/include/mariadb/mysql -I./include -I/var/sas/scrap_venv/include -I/usr/include/python3.8 -c mariadb/mariadb_connection.c -o build/temp.linux-x86_64-cpython-38/mariadb/mariadb_connection.o -DDEFAULT_PLUGINS_SUBDIR="/usr/lib/mariadb/plugin"
      x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -DPY_MARIADB_MAJOR_VERSION=1 -DPY_MARIADB_MINOR_VERSION=1 -DPY_MARIADB_PATCH_VERSION=3 -DPY_MARIADB_PRE_RELEASE_SEGMENT="" -I/usr/include/mariadb -I/usr/include/mariadb/mysql -I./include -I/var/sas/scrap_venv/include -I/usr/include/python3.8 -c mariadb/mariadb_cursor.c -o build/temp.linux-x86_64-cpython-38/mariadb/mariadb_cursor.o -DDEFAULT_PLUGINS_SUBDIR="/usr/lib/mariadb/plugin"
      mariadb/mariadb_cursor.c: In function ‘MrdbCursor_execute_binary’:
      mariadb/mariadb_cursor.c:1094:48: error: ‘const struct st_mariadb_methods’ has no member named ‘db_execute_generate_request’
       1094 |     if (!(buf= self->connection->mysql->methods->db_execute_generate_request(self->stmt, &buflen, 1)))
            |                                                ^~
      mariadb/mariadb_cursor.c:1058:20: warning: variable ‘buf’ set but not used [-Wunused-but-set-variable]
       1058 |     unsigned char *buf= NULL;
            |                    ^~~
      mariadb/mariadb_cursor.c: In function ‘MrdbCursor_execute_bulk’:
      mariadb/mariadb_cursor.c:1205:48: error: ‘const struct st_mariadb_methods’ has no member named ‘db_execute_generate_request’
       1205 |     if (!(buf= self->connection->mysql->methods->db_execute_generate_request(self->stmt, &buflen, 1)))
            |                                                ^~
      mariadb/mariadb_cursor.c:1169:20: warning: variable ‘buf’ set but not used [-Wunused-but-set-variable]
       1169 |     unsigned char *buf= NULL;
            |                    ^~~
      error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> mariadb

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

Any hint on how to install it?

Best,
apnow

2

Answers


  1. Chosen as BEST ANSWER

    @phd: I did uninstall python2-dev (yes, it was not needed)

    @Georg Ritcher: I did remove the libmysqlclient installed previously for a MySQL connection. I also executed the commands you mentioned above and somehow, it worked!

    I did receive this output:

    Collecting mariadb
      Using cached MariaDB-1.1.3.tar.gz (80 kB)
      Preparing metadata (setup.py): started
      Preparing metadata (setup.py): finished with status 'done'
    Building wheels for collected packages: mariadb
      Building wheel for mariadb (setup.py): started
      Building wheel for mariadb (setup.py): finished with status 'done'
      Created wheel for mariadb: filename=mariadb-1.1.3-cp38-cp38-linux_x86_64.whl size=46386 sha256=fb15f61a17c9ff2ccc924c8c530bcf0817573498b9c4942feccbde7d7eaacceb
      Stored in directory: /home/apnow/.cache/pip/wheels/cd/97/c7/77b7fa75c136ad230c5352abc75f29ae024da818057add5e7d
    Successfully built mariadb
    Installing collected packages: mariadb
    Successfully installed mariadb-1.1.3
    

    I can see mariadb 1.1.3 installed on my environment now. Maybe the libmysqlclient was affecting the installation of it?

    Thanks for all support!

    All best, apnow


  2. Since setup.py doesn’t claim about missing Connector/C version (required is C/C 3.2.4 for Connector/Python 1.1.x) it looks like that mariadb_config (which will be used to check the installed version) was found, but somewhere is another mysql.h include file (either from an older MariaDB Connector/C, MariaDB Server or MySQL installation) which will be used instead.

    I would suggest to check the include paths for the build:

    export CFLAGS="-v -E"
    pip3 install mariadb >& output.txt
    

    Then open output.txt in your favourite editor and search for "search starts here" where you can see the include paths for the build:

    #include "..." search starts here:
    #include <...> search starts here:
     /usr/local/include/mariadb
     /usr/local/include/mariadb/mysql
     ./include
     /usr/local/include/python3.10
     /usr/lib/gcc/x86_64-linux-gnu/10/include
     /usr/local/include
     /usr/include/x86_64-linux-gnu
     /usr/include
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search