LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-07-2022, 08:27 PM   #1
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,683
Blog Entries: 4

Rep: Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947
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.
 
Old 06-08-2022, 02:00 PM   #2
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,151
Blog Entries: 6

Rep: Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835
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.

Isn't python-mysqlclient in your distros repo? If not, here it is.
https://github.com/PyMySQL/mysqlclient

Maybe someone else knows more.
 
Old 06-08-2022, 02:19 PM   #3
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,683

Original Poster
Blog Entries: 4

Rep: Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947
I solved this problem!

The original error output was as follows:

Code:
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:
Code:
export PATH=/usr/local/mysql-5.7.16-osx10.11-x86_64/bin:$PATH
Once I did this, the installation worked.

Last edited by sundialsvcs; 06-08-2022 at 02:24 PM.
 
Old 06-08-2022, 11:46 PM   #4
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Please mark your thread SOLVED (see my signature). Others will benefit.
 
Old 06-09-2022, 10:10 AM   #5
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,683

Original Poster
Blog Entries: 4

Rep: Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947
I can't access that page ... "permission denied" of some kind. This should be a public "sticky."
 
Old 06-10-2022, 02:00 PM   #6
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by sundialsvcs View Post
I can't access that page ... "permission denied" of some kind. This should be a public "sticky."
Gaslighting.
I can see the LQ blog post from a different IP even without logging in.
 
Old 06-14-2022, 07:29 PM   #7
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,683

Original Poster
Blog Entries: 4

Rep: Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947
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!)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Image viewer that supports editing metadata and sorting/viewing by metadata? ahc_fan Linux - Software 1 12-02-2015 11:08 AM
LXer: Python Python Python (aka Python 3) LXer Syndicated Linux News 0 08-05-2009 08:30 PM
"Failed to retrieve metadata" error with binhost Gentoo konqi Linux - Software 10 08-21-2008 05:50 AM
Could anybody please tell how to install [B]mysqlclient.a[/B] library in [B]/usr/lib. krisvamc Linux - Software 5 04-24-2007 04:08 AM
Could anybody please tell how to install [B]mysqlclient.a[/B] library in [B]/usr/lib. krisvamc Ubuntu 7 04-06-2007 05:35 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:41 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration