3

I'm writing a discord bot in python and I want to host it on my vps using pterodactyl. The only problem is that I can't run the mariadb module.

When installing mariadb~=1.0.9 from requirements.txt, I get this error in the console:

Collecting mariadb~=1.0.9
  Using cached mariadb-1.0.9.zip (85 kB)
    ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-5af1rjco/mariadb_79202a8d2ec6465081f14415b6232796/setup.py'"'"'; __file__='"'"'/tmp/pip-install-5af1rjco/mariadb_79202a8d2ec6465081f14415b6232796/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-t7yd4lwb
         cwd: /tmp/pip-install-5af1rjco/mariadb_79202a8d2ec6465081f14415b6232796/
    Complete output (17 lines):
    /bin/sh: 1: mariadb_config: not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-5af1rjco/mariadb_79202a8d2ec6465081f14415b6232796/setup.py", line 26, in <module>
        cfg = get_config(options)
      File "/tmp/pip-install-5af1rjco/mariadb_79202a8d2ec6465081f14415b6232796/mariadb_posix.py", line 59, in get_config
        cc_version = mariadb_config(config_prg, "cc_version")
      File "/tmp/pip-install-5af1rjco/mariadb_79202a8d2ec6465081f14415b6232796/mariadb_posix.py", line 28, in mariadb_config
        raise EnvironmentError(
    OSError: mariadb_config not found.
    
    Please make sure, that MariaDB Connector/C is installed on your system.
    Either set the environment variable MARIADB_CONFIG or edit the configuration
    file 'site.cfg' and set the 'mariadb_config option, which should point
    to the mariadb_config utility.
    The MariaDB Download website at <https://downloads.mariadb.com/Connectors/c/>
    provides latest stable releease of Connector/C.
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/e4/b0/0fa0bf67c347464e04c970e406e6d4b0eea0b76c9aff6111c85708950cfc/mariadb-1.0.9.zip#sha256=02a9b3d0a076e9a0d0ea1c48b45ed09b6475e2b6a4e8c81ed9f1e82caf3bfc29 (from https://pypi.org/simple/mariadb/) (requires-python:>=3.6). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement mariadb~=1.0.9 (from versions: 0.9.52, 0.9.53, 0.9.54, 0.9.55, 0.9.56, 0.9.57, 0.9.58, 0.9.59, 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.0.6, 1.0.7, 1.0.8, 1.0.9, 1.1.0a1, 1.1.0b1, 1.1.0b2)
ERROR: No matching distribution found for mariadb~=1.0.9

I looked at other similar questions and installed:

MariaDB Connector/C, which is a dependency.

sudo apt-get install libmariadb3 libmariadb-dev

PIP to install MariaDB Connector/Python.

pip3 install mariadb

As I watched, mariadb installed in my folder: /usr/local/lib/python3.8/dist-packages, but in the discord-bot server location in the /var/lib/pterodactyl/volumes/0a4e3290-1f7f-4b2a-8754-02402baef643/.local/lib/python3.10/site-packages mariadb module is missing

I've tried solutions with these answers but nothing

Problem with pip install mariadb - mariadb_config not found
Python MariaDB pip install failed, missing mariadb_config
mysql_config not found when installing mysqldb python interface for mariadb 10 Ubuntu 13.10

ubuntu version 20.04

3
  • libmariadb-dev does include mariadb_config. I tried installing the packages stated in a container and pip3 install mariadb and this worked without error. Verify dpkg -L libmariadb-dev shows mariadb_config, you can run mariadb_config separately. Commented Jan 8, 2022 at 23:28
  • I already have installed mariadb in my .local folder, but i still get error: File "/home/container/.local/lib/python3.10/site-packages/mariadb/__init__.py", line 10, in <module>from ._mariadb import (ModuleNotFoundError: No module named 'mariadb._mariadb' Commented Jan 9, 2022 at 3:58
  • Got this problem on rapberry pi os, but there it worked with "apt install libmariadb-dev", however it did not install the latest version. So your problem may be a to old version of mariadb. (But since this is a guess, I did not put this as a answer). Commented Sep 16, 2022 at 7:01

1 Answer 1

0

If using Redhat, just yum install python3-pymysql and python3 -m pip install pymysql. For some reason rhel 8 does not have the right mariadb connector version and so latest mariadb pip package cannot be installed.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.