0

This is what I get when I run the command pip install mariadb:

Defaulting to user installation because normal site-packages is not writeable
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 "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-6kwo2pga/mariadb_84568c03780743cba30d255711f92d08/setup.py", line 27, in <module>
          cfg = get_config(options)
        File "/tmp/pip-install-6kwo2pga/mariadb_84568c03780743cba30d255711f92d08/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.

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

I tried solving it for hours, but I couldn't do it and I came here, in need for solutions. Yes, I installed the connector as well, even my teacher got surprised that I got that error after I tried installing the connector (https://mariadb.com/docs/connect/programming-languages/c/install/#connector-c-install-repo-install).

I tried reinstalling python and pip (not the best idea, because that took some time and I also had to reinstall my Desktop). I also ran sudo apt update and sudo apt upgrade, but nothing. I have even fixed it (it was literally broken, and I had to remove the package he was trying to update).

Anyways, I am totally clueless, I have even looked on other answers on stackoverflow and github regarding the same question, but it just seems like I cannot make it work for some reason. I would love some help if someone could assist me!

RidiX
  • 819
  • 6
  • 9
  • 1
    Does this answer your question? [python, mariadb library and his connector inside a docker container](https://stackoverflow.com/questions/73350980/python-mariadb-library-and-his-connector-inside-a-docker-container) – Georg Richter Oct 19 '22 at 20:43
  • Not really... I wanted my application to be dockerless, at least for now. That, but also that the person who posted their question still has it unsolved... – RidiX Oct 19 '22 at 20:48
  • and what is the output of mariadb_config --version ? – Georg Richter Oct 19 '22 at 20:53
  • 1
    If you can avoid the 3 bugs and 1 feature that [1.1.4 fixes](https://jira.mariadb.org/issues/?jql=project%20%3D%20CONPY%20AND%20fixVersion%20%3D%201.1.4) is using 1.1.3 an acceptable solution? – danblack Oct 19 '22 at 22:44
  • Its version is 10.3.34 – RidiX Oct 20 '22 at 04:47
  • Also, downgrading to 1.1.3 wasn't the solution, but going to 1.0's versions did it... I totally don't understand why did an older version didn't throw the error the newer versions throw... – RidiX Oct 20 '22 at 04:49

2 Answers2

2

Check the installed version of MariaDB Connector/C. Required version is > 3.2.4.

mariadb_config --cc_version

If the installed version is too old, you have to upgrade Connector/C.

From Installation FAQ:

The previously installed version of MariaDB Connector/C is too old and cannot be used for the MariaDB Connector/Python version you are trying to install.

  • Check if your distribution can be upgraded to a more recent version of MariaDB Connector/C, which fits the requirements.

  • If your distribution doesn’t provide a recent version of MariaDB Connector/C, check the MariaDB Connector Download page, which provides latest versions for the major distributions.

  • If none of the above will work for you, build and install MariaDB Connector/C from source.

Please also note that MariaDB Server and MariaDB Connector/C are different packages.

Georg Richter
  • 5,970
  • 2
  • 9
  • 15
0

Installing an older version of mariadb did it for me, especially those with 1.0.

pip install mariadb==1.0.11

I also needed to run it in the pycharm terminal to make it work with the venv.

But trying to install the most recent version will throw the same error as documented in the question, no matter what I do.

RidiX
  • 819
  • 6
  • 9