Search code examples
pipmariadb

Receiving an error when installing MariaDB via pip3


Im receiving an error when installing mairadb via pip3. Below is the command and error.

sudo pip3 install mariadb
------------------------------------------------------------------
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting mariadb
  Using cached mariadb-1.0.0.tar.gz (78 kB)
    ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python3.8 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-z5vslgxx/mariadb/setup.py'"'"'; __file__='"'"'/tmp/pip-install-z5vslgxx/mariadb/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-hfv4vge6
         cwd: /tmp/pip-install-z5vslgxx/mariadb/
    Complete output (12 lines):
    /bin/sh: 1: mariadb_config: not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-z5vslgxx/mariadb/setup.py", line 26, in <module>
        cfg = get_config(options)
      File "/tmp/pip-install-z5vslgxx/mariadb/mariadb_posix.py", line 49, in get_config
        cc_version = mariadb_config(config_prg, "cc_version")
      File "/tmp/pip-install-z5vslgxx/mariadb/mariadb_posix.py", line 26, in mariadb_config
        raise EnvironmentError(
    OSError: mariadb_config not found.
    Please make sure, that MariaDB Connector/C is installed on your system, edit the configuration file 'site.cfg' and set the 'mariadb_config'
    option, which should point to the mariadb_config utility.
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

I have updated setuptools for pip via sudo pip3 install --upgrade setuptools to no avail. This error also occurs when trying to install most sql related modules for example mysql.


Solution

  • I am now able to install MariaDB 1.0.0 (and above) connector with no issues now. If you are receiving an OS error, install the mariadbclient-dev package with sudo apt-get install libmariadb-dev then you can install with pip3 install mariadb.