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 |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
|
|
10-09-2024, 07:32 PM
|
#1
|
LQ Guru
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,935
|
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.
|
|
|
10-10-2024, 11:02 AM
|
#2
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 23,029
|
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.
|
|
|
10-10-2024, 06:49 PM
|
#3
|
LQ Guru
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,935
Original Poster
|
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."
|
|
|
10-10-2024, 11:39 PM
|
#4
|
Senior Member
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,800
|
Quote:
Originally Posted by sundialsvcs
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.
|
|
|
10-11-2024, 01:14 AM
|
#5
|
Senior Member
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,936
|
Mind you pkg-config depends on glib, and glib depends on pkg-config.
|
|
|
10-11-2024, 05:33 AM
|
#6
|
Senior Member
Registered: Apr 2010
Posts: 2,276
|
brew install mysql-client << this one no error?
pip3 install mysqlclient << however, this one got error?
or what?
|
|
|
10-11-2024, 12:57 PM
|
#7
|
LQ Guru
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,935
Original Poster
|
@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.
|
|
|
10-11-2024, 05:20 PM
|
#8
|
Senior Member
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,800
|
Quote:
Originally Posted by sundialsvcs
@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)?
|
|
|
10-11-2024, 09:55 PM
|
#9
|
LQ Guru
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,935
Original Poster
|
@rtubski: I will pursue this line of reasoning and check back. Your hypothesis smells promising ...
|
|
|
10-12-2024, 03:29 AM
|
#10
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 23,029
|
Quote:
Originally Posted by sundialsvcs
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.
|
10-12-2024, 10:16 AM
|
#11
|
LQ Guru
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,935
Original Poster
|
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 ...
|
|
|
10-12-2024, 10:32 AM
|
#12
|
Senior Member
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,800
|
Quote:
Originally Posted by sundialsvcs
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 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?).
|
|
|
10-13-2024, 09:00 AM
|
#13
|
LQ Guru
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,935
Original Poster
|
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.
|
|
|
10-13-2024, 10:00 AM
|
#14
|
Senior Member
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,936
|
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.
|
|
|
10-13-2024, 02:22 PM
|
#15
|
LQ Guru
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,935
Original Poster
|
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.
|
All times are GMT -5. The time now is 01:59 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|