I try to install mariadb package on my ubuntu 20.04 and I get this message :
Collecting mariadb
Using cached mariadb-1.1.3.tar.gz (80 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 "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-t71j4ld7/mariadb_85318304dde74615894ef8d77544330a/setup.py", line 26, in <module>
cfg = get_config(options)
File "/tmp/pip-install-t71j4ld7/mariadb_85318304dde74615894ef8d77544330a/mariadb_posix.py", line 63, in get_config
cc_version = mariadb_config(config_prg, "cc_version")
File "/tmp/pip-install-t71j4ld7/mariadb_85318304dde74615894ef8d77544330a/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
at: https://github.com/mariadb-corporation/mariadb-connector-c/wiki/install.md.
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.
[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 found many subject and answer about this topic like update and upgrade the system, upgrade my pip version or install packages like libmariadbclient-dev, setuptools or libmysqlclient-dev.
I installed libmariadb-dev on my system too but none of these solutions works for me.
python3 –version : Python 3.8.10
pip –version : pip 22.1.2
Thanks for your help !
3
Answers
It is not enough to install libmariadb-dev, you also need to install libmariadb (afaik it is libmariadb3 on focal), since mariadb-config binary is not part of the dev package.
sudo apt-get install libmariadb3 libmariadb-dev
.Another option would be to install the server package, which also contains MariaDB Connector/C.
I got the same problem while installing
termcolor
. And, found the solution at this site. (i am no way related to that site. Just browsed it.).For me, using
worked well. The problem was that, I was using an older version of
setuptools
which was not able to install the packages with latest updates.POSSIBLE SOLUTION: upgrade all other packages and THEN install the package in question.
I came across similar errors when upgrading python packages:
but several packages wouldn’t install and throw the error:
python setup.py egg_info did not run successfully.
So I excluded the packages from the upgrade:
After the upgrade of all upgradable packages I could install the problem children: