Issue installing python Maridb connector

pip3 install mariadb

You get this horrible error

ERROR

Collecting mariadb
Using cached mariadb-1.1.4.zip (97 kB)
Preparing metadata (setup.py) … error
error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [19 lines of output]
/bin/sh: 1: mariadb_config: not found
Traceback (most recent call last):
File “”, line 2, in
File “”, line 34, in
File “/tmp/pip-install-32k757or/mariadb_560a9c79f0774df188515c949126bd19/setup.py”, line 27, in
cfg = get_config(options)
File “/tmp/pip-install-32k757or/mariadb_560a9c79f0774df188515c949126bd19/mariadb_posix.py”, line 62, in get_config
cc_version = mariadb_config(config_prg, “cc_version”)
File “/tmp/pip-install-32k757or/mariadb_560a9c79f0774df188515c949126bd19/mariadb_posix.py”, line 28, in mariadb_config
raise EnvironmentError(
OSError: mariadb_config not found.

This error typically indicates that MariaDB Connector/C, a dependency which
must be preinstalled, is not found.
If MariaDB Connector/C is not installed, see installation instructions
If MariaDB Connector/C is installed, either set the environment variable
MARIADB_CONFIG or edit the configuration file ‘site.cfg’ to set the
‘mariadb_config’ option to the file location of the mariadb_config utility.

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

note: This error originates from a subprocess and is likely not a problem with pip.
error: metadata-generation-failed

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

To try and fix this

apt install libmariadb-dev-compat libmariadb-dev libmariadb3
apt install libmysqlclient-dev debhelper cmake

pip3 install mariadb

Okay, we are getting closer, more of Google prompted more and more commands

ERROR

Collecting mariadb
Using cached mariadb-1.1.4.zip (97 kB)
Preparing metadata (setup.py) … error
error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [8 lines of output]
Traceback (most recent call last):
File “”, line 2, in
File “”, line 34, in
File “/tmp/pip-install-2k9bqtur/mariadb_022e270d18ab4211a7bc02f1846384aa/setup.py”, line 27, in
cfg = get_config(options)
File “/tmp/pip-install-2k9bqtur/mariadb_022e270d18ab4211a7bc02f1846384aa/mariadb_posix.py”, line 64, in get_config
print(‘MariaDB Connector/Python requires MariaDB Connector/C ‘
TypeError: not enough arguments for format string
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

pip3 install --upgrade pip setuptools wheel
pip3 install python-language-server

Still nothing.

I then dropped on this, https://mariadb.com/kb/en/mariadb-connector-c-332-release-notes/

The issue was how to install it after downloading, so more of Google.

Then from here https://mariadb.com/docs/connect/programming-languages/c/install/#connector-c-install-repo-install

cd /opt

wget https://downloads.mariadb.com/MariaDB/mariadb_repo_setup
echo "733cf126b03f73050e242102592658913d10829a5bf056ab77e7f864b3f8de1f  mariadb_repo_setup" \
    | sha256sum -c -
chmod +x mariadb_repo_setup
./mariadb_repo_setup \
   --mariadb-server-version="mariadb-10.6"

apt update && apt upgrade

cd /opt/superset

pip3 install mariadb

pip3 install mysqlclient

1 thought on “Issue installing python Maridb connector”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s