How to install MariaDB support for Python in Fed37?

I am struggling with the support for python for MariaDB in Fedora 37.

I did:
$ sudo dnf install python-devel mariadb-connector-c-devel mariadb-connector-c mariadb-devel python3-pip
$ python3 -m venv venv
$ source venv/bin/activate
(venv)$ pip3 install mariadb

Error message:

Collecting mariadb
  Using cached mariadb-1.1.5.post3.tar.gz (82 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  Γ— Getting requirements to build wheel did not run successfully.
  β”‚ exit code: 2
  ╰─> [1 lines of output]
      MariaDB Connector/Python requires MariaDB Connector/C >= 3.3.1, found version 3.2.7
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

Γ— Getting requirements to build wheel did not run successfully.
β”‚ exit code: 2
╰─> See above for output.

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

[notice] A new release of pip available: 22.2.2 -> 22.3.1
[notice] To update, run: pip install --upgrade pip

It seems that MariaDB Connector/C >= 3.3.1 is required.
From https://mariadb.com/downloads/connectors/connectors-data-access/c-connector/ I see downloads for manual installation for different OS but not for Fed37.

How to solve this?

Any help is appreciated.

Karl …

You can’t install a newer version than Fedora has built, but you can install an older version of the Python package. The previous version appears to work:

$ pip3 install mariadb==1.1.4
Collecting mariadb==1.1.4
  Downloading mariadb-1.1.4.zip (97 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 97.4/97.4 kB 4.4 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Using legacy 'setup.py install' for mariadb, since package 'wheel' is not installed.
Installing collected packages: mariadb
  Attempting uninstall: mariadb
    Found existing installation: mariadb 1.1.2
    Uninstalling mariadb-1.1.2:
      Successfully uninstalled mariadb-1.1.2
  Running setup.py install for mariadb ... done
Successfully installed mariadb-1.1.4

(Note, you also need to dnf install gcc if you haven’t already.)

See also the maintainer’s notes in the update bug:
https://bugzilla.redhat.com/show_bug.cgi?id=2090416#c11

Mariadb is available for direct install from the fedora repo

# dnf list mariadb
Last metadata expiration check: 3:03:07 ago on Sun 22 Jan 2023 03:50:45 PM CST.
Installed Packages
mariadb.x86_64                                                 3:10.5.18-1.fc37                                                  @updates

It is not necessary to install it piecemeal with python or pip.

That is the database itself, not the Python connector library.

1 Like

Answer is simply here : https://mariadb.com/resources/blog/how-to-connect-python-programs-to-mariadb/. Python is a scripting language, MariaDB a database …

For what it’s worth, I normally just use the MySQL driver in Python with MariaDB:

sudo dnf install python3-mysqlclient

Here are the docs for this driver:

https://mysqlclient.readthedocs.io/

Thanks.

mariadb==1.1.4

is the trick. This is working for me in Fed36 and Fed37.

1 Like