0

I am developing an app using Django 4 and have set up a virtual environment using venv. The problem is that I cannot get the MySQL client package installed using pip to allow my Django app to connect to an existing MariaDB hosted on the same server.

I am using Fedora 37, Python 3.11.1 .

Every time I try to install mysqlclient via pip within my virtual environment I the below error:

(venv) $ pip install mysqlclient Collecting mysqlclient Using cached mysqlclient-2.1.1.tar.gz (88 kB) Preparing metadata (setup.py) ... error error: subprocess-exited-with-error × python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [18 lines of output] /bin/sh: line 1: mysql_config: command not found /bin/sh: line 1: mariadb_config: command not found /bin/sh: line 1: mysql_config: command not found Traceback (most recent call last): File "", line 2, in File "", line 34, in File "/tmp/pip-install-fuegkdx1/mysqlclient_d3182534a7ce4d10ae4bceac47107c54/setup.py", line 15, in metadata, options = get_config() ^^^^^^^^^^^^ File "/tmp/pip-install-fuegkdx1/mysqlclient_d3182534a7ce4d10ae4bceac47107c54/setup_posix.py", line 70, in get_config libs = mysql_config("libs") ^^^^^^^^^^^^^^^^^^^^ File "/tmp/pip-install-fuegkdx1/mysqlclient_d3182534a7ce4d10ae4bceac47107c54/setup_posix.py", line 31, in mysql_config raise OSError("{} not found".format(_mysql_config_path)) OSError: mysql_config not found mysql_config --version mariadb_config --version mysql_config --libs [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.

Shadow
  • 33,525
  • 10
  • 51
  • 64
  • Have you tried answer of this question: https://apple.stackexchange.com/questions/358693/unable-to-install-python-mysqlclient-oserror-mysql-config-not-found or https://stackoverflow.com/questions/72538597/python-mysqlclient-installation-fails-with-metadata-generation-failed – Jbertrand Feb 09 '23 at 22:17
  • https://stackoverflow.com/search?q=%5Bpip%5D+%2Fbin%2Fsh%3A+line+1%3A+mysql_config%3A+command+not+found – phd Feb 09 '23 at 23:58
  • Esp. see these answers: https://stackoverflow.com/a/22013331/7976758 , https://stackoverflow.com/a/28414414/7976758 – phd Feb 09 '23 at 23:59

0 Answers0