Python "mysqlclient" install fails with "metadata-generation-failed" (SOLVED)
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Python "mysqlclient" install fails with "metadata-generation-failed" (SOLVED)
Having briefly wasted my time with "stackoverflow," it occurs to me that this might be a much more productive forum upon which to ask this question.
A "pip" installation of the "mysqlclient" package is currently failing with the error message: "metadata-generation-failed." A superficial exam of the usual internet places does not find a useful explanation, and the handful of "solutions" that I have found make no sense. Therefore, and before I "dumpster-dive" into the relevant install scripts ... does anyone here have any idea?
(I've done a bit of questioning into what MySQL might mean by "metadata," but I'm not uncovering anything that need be "generated," especially as part of a perfectly routine "client interface package" installation ...)
Last edited by sundialsvcs; 06-08-2022 at 02:19 PM.
I don't know what that refers to. I never use pip to install python anything. I don't like it. It's outside of ones package manager. I've seen it cause all kinds of problems. Even when things install without error, one still messes up the python tree, so that the package manager does not know about it.
Collecting mysqlclient
Using cached mysqlclient-2.1.0.tar.gz (87 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [16 lines of output]
/bin/sh: mysql_config: command not found
/bin/sh: mariadb_config: command not found
/bin/sh: mysql_config: command not found
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/private/var/folders/zv/60vkqgms41v8zg76_n8rntg00000gn/T/pip-install-_nlyaw6p/mysqlclient_a781e05976524422b764a6902ff6fe88/setup.py", line 15, in <module>
metadata, options = get_config()
File "/private/var/folders/zv/60vkqgms41v8zg76_n8rntg00000gn/T/pip-install-_nlyaw6p/mysqlclient_a781e05976524422b764a6902ff6fe88/setup_posix.py", line 70, in get_config
libs = mysql_config("libs")
File "/private/var/folders/zv/60vkqgms41v8zg76_n8rntg00000gn/T/pip-install-_nlyaw6p/mysqlclient_a781e05976524422b764a6902ff6fe88/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.
I then realized that the crux of the problem was:
Code:
/bin/sh: mysql_config: command not found
"Metadata generation failed" obviously means that Pip could not find the necessary command to do it.
The solution turned out to be to find where the mysql_config command was located on my system (using "locate" ...), and to temporarily add it to $PATH, which in my (MacOS ...) case required the following command:
No "gaslighting" here ... how silly to suggest such a thing.
When I follow the link at the bottom of this person's various posts, yes while logged-in, I wind up at an "access denied" page. And so, since the technique is not obvious (I literally still do not know how to do it, after all these years ...), I think that the forum owners should make it a public "sticky." (Lots of things in this world are "obvious" once you know them! And, that's why we have a "facepalm" emoji!)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.