Search code examples
pythonpipmariadbversion

mariadb package installation difficulties


This is in WSL (Ubuntu 20.04).

I've set up a Python VE with 3.10.10.

I've done apt install of python3.10-venv, python3.10-dev, python3.10-minimal and python3.10-distutils.

I've managed to activate the VE and do pip install with a few packages. But I'm having problems with mariadb.

First, when I went pip install mariadb it complained

This error typically indicates that MariaDB Connector/C, a dependency which must be preinstalled, is not found.

So then I went sudo apt install libmariadb3 libmariadb-dev... and then it complained:

Connector/Python requires MariaDB Connector/C >= 3.3.1, found version 3.1.20

So then I downloaded a tar.gz from here: mariadb-connector-c-3.3.4-ubuntu-jammy-amd64.tar.gz

Then I followed the instructions here, section "Install from source distribution".

After expanding I get this:

(sysadmin_wsl) root@M17A:/mnt/d/apps/MariaDB/mariadb-connector-python# pip install ./mariadb-connector-c-3.3.4-ubuntu-jammy-amd64
ERROR: Directory './mariadb-connector-c-3.3.4-ubuntu-jammy-amd64' is not installable. Neither 'setup.py' nor 'pyproject.toml' found.

Indeed, neither of these files is present.

Any suggestions?


Solution

  • There was an old version that supports MariaDB Connector/C 3.1.5. It was committed on July 15, 2020. So you can try to install that old mariadb. See https://pypi.org/project/mariadb/#history , versions that close to the date are 1.0.0 and 1.0.1.

    So my advice: try pip install "mariadb < 1.1". It must install mariadb==1.0.11 which should be ok, see https://github.com/mariadb-corporation/mariadb-connector-python/blob/v1.0.11/mariadb_posix.py#L45