LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 10-09-2024, 07:32 PM   #1
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,935
Blog Entries: 4

Rep: Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018
Can anyone help me with this Python problem? (MacOS)


I'm trying to do pip3 install mysqlclient on a MacOS system. I did brew install mysql-client ahead of time. And I realize that i really don't quite understand this error:

Code:
× Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [27 lines of output]
      Trying pkg-config --exists mysqlclient
      Command 'pkg-config --exists mysqlclient' returned non-zero exit status 1.
      Trying pkg-config --exists mariadb
      Command 'pkg-config --exists mariadb' returned non-zero exit status 1.
      Trying pkg-config --exists libmariadb
      Command 'pkg-config --exists libmariadb' returned non-zero exit status 1.
      Traceback (most recent call last):
        File "/Users/mike/.virtualenvs/djangoprod/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/Users/mike/.virtualenvs/djangoprod/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/mike/.virtualenvs/djangoprod/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/zv/60vkqgms41v8zg76_n8rntg00000gn/T/pip-build-env-ee59svf4/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 332, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/zv/60vkqgms41v8zg76_n8rntg00000gn/T/pip-build-env-ee59svf4/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 302, in _get_build_requires
          self.run_setup()
        File "/private/var/folders/zv/60vkqgms41v8zg76_n8rntg00000gn/T/pip-build-env-ee59svf4/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 318, in run_setup
          exec(code, locals())
        File "<string>", line 155, in <module>
        File "<string>", line 49, in get_config_posix
        File "<string>", line 28, in find_package_name
      Exception: Can not find valid pkg-config name.
      Specify MYSQLCLIENT_CFLAGS and MYSQLCLIENT_LDFLAGS env vars manually
I haven't had to do something like this in the past – specifying environment variables. Like I said, I guess I just don't quite understand what this error-message is now trying to tell me. (I think that the last two lines are probably the crux of it ...)

No, it's not exactly a "Linux question," but it is Python, and I hope that counts. (An inquiry on "StackExchange" was fruitless.)

AtDhVaAnNkCsE = "Thanks in Advance."

Last edited by sundialsvcs; 10-09-2024 at 07:33 PM.
 
Old 10-10-2024, 11:02 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 23,029

Rep: Reputation: 7628Reputation: 7628Reputation: 7628Reputation: 7628Reputation: 7628Reputation: 7628Reputation: 7628Reputation: 7628Reputation: 7628Reputation: 7628Reputation: 7628
it is not a python error, it is just the extremely stupid error handling implemented in that script. it is looking for a tool named pkg-config and could not find it.
 
Old 10-10-2024, 06:49 PM   #3
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,935

Original Poster
Blog Entries: 4

Rep: Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018
Superficially, "I thought so, too." However, the last message(s) seem to suggest something different.

It could well be something too-specific to the MacOS environment. I'll have to online-research these particular environment vars ...

I know that "I didn't used to encounter it," but of course everything in open-source software is "constantly changing."
 
Old 10-10-2024, 11:39 PM   #4
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,800

Rep: Reputation: 2090Reputation: 2090Reputation: 2090Reputation: 2090Reputation: 2090Reputation: 2090Reputation: 2090Reputation: 2090Reputation: 2090Reputation: 2090Reputation: 2090
Quote:
Originally Posted by sundialsvcs View Post
Superficially, "I thought so, too." However, the last message(s) seem to suggest something different.
pkg-config is a tool which can give the needed compiler flags to use when compiling with some library/package. The message is telling you that if you already know what compiler flags to use with the mysqlclient/mariadb library, then you can specify them in those environment vars instead of having it configured automatically by pkg-config.

But it's probably easier to just install pkg-config.
 
Old 10-11-2024, 01:14 AM   #5
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,936
Blog Entries: 1

Rep: Reputation: 1893Reputation: 1893Reputation: 1893Reputation: 1893Reputation: 1893Reputation: 1893Reputation: 1893Reputation: 1893Reputation: 1893Reputation: 1893Reputation: 1893
Mind you pkg-config depends on glib, and glib depends on pkg-config.
 
Old 10-11-2024, 05:33 AM   #6
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,276

Rep: Reputation: 463Reputation: 463Reputation: 463Reputation: 463Reputation: 463
brew install mysql-client << this one no error?

pip3 install mysqlclient << however, this one got error?

or what?
 
Old 10-11-2024, 12:57 PM   #7
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,935

Original Poster
Blog Entries: 4

Rep: Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018
@ntubski: Vital to know. Because I did not know and would not have guessed.

So far as I can see, then, "pkg-config" did run three times. So, it's installed. Now, since we are installing "mysqlclient," it doesn't yet exist. Therefore, I really don't know why the script is testing for these three things. (And, I'm not going to find out.)

- - -

@JJJCR: You are correct. "brew" ran, although it said a message at the end that "it wasn't going to symlink into /usr/local/Cellar because it would conflict with mysql." (I am not using the "brew" version of MySQL.) I don't know what that might mean. The error-trace reproduced above came from the "pip3" install attempt.

- - -

So, I am still sleuthing for the real cause, which is still lurking. Thanks very much, everyone, for your help.

Remember: all of this used to work, on the same system. But of course, "everything is always changing."

Last edited by sundialsvcs; 10-11-2024 at 01:05 PM.
 
Old 10-11-2024, 05:20 PM   #8
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,800

Rep: Reputation: 2090Reputation: 2090Reputation: 2090Reputation: 2090Reputation: 2090Reputation: 2090Reputation: 2090Reputation: 2090Reputation: 2090Reputation: 2090Reputation: 2090
Quote:
Originally Posted by sundialsvcs View Post
@ntubski: Vital to know. Because I did not know and would not have guessed.

So far as I can see, then, "pkg-config" did run three times. So, it's installed.
Actually, the error message is unclear, it seems the python builder thing attempted to run pkg-config three times and it failed all three times. There's not enough information to tell whether that's because pkg-config is not installed (so it failed all three times with missing command), or the specific packages passed to the --exists option were not found. In the latter case it could be you need to install some kind of -dev package for the mysqlclient library (I'm not familiar with the specifics of the macOS packaging system)?
 
Old 10-11-2024, 09:55 PM   #9
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,935

Original Poster
Blog Entries: 4

Rep: Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018
@rtubski: I will pursue this line of reasoning and check back. Your hypothesis smells promising ...
 
Old 10-12-2024, 03:29 AM   #10
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 23,029

Rep: Reputation: 7628Reputation: 7628Reputation: 7628Reputation: 7628Reputation: 7628Reputation: 7628Reputation: 7628Reputation: 7628Reputation: 7628Reputation: 7628Reputation: 7628
Quote:
Originally Posted by sundialsvcs View Post
So far as I can see, then, "pkg-config" did run three times. So, it's installed.
based on the log you posted: no. the python script tried to execute it, but failed. Actually we don't know why, most probably because it is unavailable (see: cannot find valid executable). But there can be other reasons too.
anyway, you can try to execute the same command in your shell (to see how does it work): pkg-config --exists mariadb
 
1 members found this post helpful.
Old 10-12-2024, 10:16 AM   #11
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,935

Original Poster
Blog Entries: 4

Rep: Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018
I looked and found that pkg-config is apparently part of the "brew" (MacOS) system. It is installed, and when I "upgraded" it it did not change since 2012. So, I am still looking at what is obviously an "edge case," not Linux-specific.

Since the "output" of this command is actually "a return-code," I for the moment am dimly forgetting how to display it ... I should know ...
 
Old 10-12-2024, 10:32 AM   #12
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,800

Rep: Reputation: 2090Reputation: 2090Reputation: 2090Reputation: 2090Reputation: 2090Reputation: 2090Reputation: 2090Reputation: 2090Reputation: 2090Reputation: 2090Reputation: 2090
Quote:
Originally Posted by sundialsvcs View Post
I looked and found that pkg-config is apparently part of the "brew" (MacOS) system. It is installed, and when I "upgraded" it it did not change since 2012. So, I am still looking at what is obviously an "edge case," not Linux-specific.
Okay, we have some progress.

Quote:
Since the "output" of this command is actually "a return-code," I for the moment am dimly forgetting how to display it ... I should know ...
I guess you're thinking of
Code:
echo $?
You can also pass the --validate option to pkg-config, which will probably give you something like this:
Code:
$ pkg-config --validate mysqlclient
Package mysqlclient was not found in the pkg-config search path.
Perhaps you should add the directory containing `mysqlclient.pc'
to the PKG_CONFIG_PATH environment variable
No package 'mysqlclient' found
You should try to see if you have any of mysqlclient.pc, mariadb.pc, or libmariadb.pc installed somewhere (wherever "brew" installs things?).
 
Old 10-13-2024, 09:00 AM   #13
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,935

Original Poster
Blog Entries: 4

Rep: Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018
Now, real progress. (Yay!) The command output from "validate" is exactly as you predicted. The "PKG_CONFIG_PATH" variable does not exist.

But – in the past, I never had to do anything like this, IIRC. Of course, things change over time.
 
Old 10-13-2024, 10:00 AM   #14
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,936
Blog Entries: 1

Rep: Reputation: 1893Reputation: 1893Reputation: 1893Reputation: 1893Reputation: 1893Reputation: 1893Reputation: 1893Reputation: 1893Reputation: 1893Reputation: 1893Reputation: 1893
Off: Last time I compiled mysql (2014, version 5.5.38), it didn't generate any *.pc file, but since then this might have been changed.
Here is an example for pc-file:
Code:
$ cat /usr/local/lib64/pkgconfig/harfbuzz.pc
prefix=/usr/local
exec_prefix=/usr/local
libdir=/usr/local/lib64
includedir=/usr/local/include

Name: harfbuzz
Description: HarfBuzz text shaping library
Version: 8.3.0

Libs: -L${libdir} -lharfbuzz
Libs.private: -lm
Requires.private: glib-2.0 >= 2.19.1 freetype2 >= 12.0.6
Cflags: -I${includedir}/harfbuzz
usage:
Code:
$ pkg-config --modversion harfbuzz
8.3.0
$ pkg-config --libs harfbuzz
-L/usr/local/lib64 -lharfbuzz

Last edited by NevemTeve; 10-13-2024 at 10:06 AM.
 
Old 10-13-2024, 02:22 PM   #15
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,935

Original Poster
Blog Entries: 4

Rep: Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018
The trusty "locate" command provided the following results:

Code:
usr/local/Cellar/mysql-client/9.0.1/lib/pkgconfig/mysqlclient.pc
/usr/local/mysql-9.0.1-macos14-x86_64/lib/pkgconfig/mysqlclient.pc
This tells me also that I probably do not need "brew" at all.

Last edited by sundialsvcs; 10-13-2024 at 02:26 PM.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] Is Anyone Dual Booting MacOS & linux on an M1/M2 Mac? business_kid Linux - General 3 06-10-2023 12:07 PM
How to Conditionally Execute Code If File in OS-Walk is Empty in Python MacOS ericlindellnyc Programming 8 08-23-2022 09:55 AM
LXer: How to set up virtual environments for Python on MacOS LXer Syndicated Linux News 0 06-03-2019 12:30 PM
LXer: The right and wrong way to set Python 3 as default on MacOS LXer Syndicated Linux News 0 05-01-2019 10:23 PM
LXer: Python Python Python (aka Python 3) LXer Syndicated Linux News 0 08-05-2009 09:30 PM

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

All times are GMT -5. The time now is 01:59 PM.

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