Home > database >  Heroku deployment failed of missing mariadb-config or MariaDB connector from remote DB
Heroku deployment failed of missing mariadb-config or MariaDB connector from remote DB

Time:07-27

Wanted to make run my Python Flask project via Heroku (it's the first time I am using it). The case is, that I connect to a remote MariaDB on a Ubuntu VM. When I try to push from local git I get an error to be related to the MariaDB. Is there an idea how I can solve this problem?

× 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-2j753bw3/mariadb_0c456c224d01457ab040c19f32e1f9ee/setup.py", line 26, in <module>

             cfg = get_config(options)

           File "/tmp/pip-install-2j753bw3/mariadb_0c456c224d01457ab040c19f32e1f9ee/mariadb_posix.py", line 63, in get_config

             cc_version = mariadb_config(config_prg, "cc_version")

           File "/tmp/pip-install-2j753bw3/mariadb_0c456c224d01457ab040c19f32e1f9ee/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]

CodePudding user response:

It looks like you need the mariadb_config utility at compile time. This is likely because whatever Python driver you are using requires it.

mariadb_config is available in the libmariadb-dev Ubuntu package. You'll need to install that using the Apt buildpack.

  1. Add the buildpack:

    heroku buildpacks:add --index 1 heroku-community/apt
    
  2. That buildpack doesn't do dependency resolution, so you'll have to list all transitive dependencies.

    Create a new file called Aptfile (no extension) that lists the dependencies you wish to install:

    mysql-common
    mariadb-common
    libmariadb3
    libmariadb-dev
    
  3. Commit your Aptfile and redeploy.

  • Related