4

I want to upgrade glib to 2.82.5 through homebrew on mac running sequoia, but it failed with this python dependency not found error

==> Upgrading glib
  2.82.4 -> 2.82.5
==> Patching
==> Applying 160e55575e2183464dbf5aa733d6c2df3c674c4c.diff
==> Applying hardcoded-paths.diff
==> meson setup build_staging -Dintrospection=disabled --localstatedir=/Applications/homebrew/var -Dgio_module_dir=/Appl
==> meson compile -C build_staging --verbose
==> meson install -C build_staging
==> meson setup build -Dcairo=disabled -Ddoctool=disabled --prefix=/private/tmp/glib-20250305-19490-3vm81q/glib-2.82.5/s
Last 15 lines from /Users/papika/Library/Logs/Homebrew/glib/04.meson:
Checking for size of "long" : 8
Found pkg-config: YES (/Applications/homebrew/Library/Homebrew/shims/mac/super/pkg-config) 2.3.0
Run-time dependency glib-2.0 found: YES 2.82.5
Run-time dependency gobject-2.0 found: YES 2.82.5
Run-time dependency gio-2.0 found: YES 2.82.5
Run-time dependency gmodule-2.0 found: YES 2.82.5
Run-time dependency gio-unix-2.0 found: YES 2.82.5
Run-time dependency libffi found: YES 3.4-rc1
Program pkg-config found: YES (/Applications/homebrew/Library/Homebrew/shims/mac/super/pkg-config)
Configuring config.h using configuration
Run-time dependency python found: NO (tried pkgconfig, pkgconfig and sysconfig)

meson.build:184:50: ERROR: Python dependency not found

A full log can be found at /private/tmp/glib--gobject-introspection-20250305-19490-y22fvf/gobject-introspection-1.82.0/build/meson-logs/meson-log.txt

Do not report this issue to Homebrew/brew or Homebrew/homebrew-core!

I checked the python files in $(brew --prefix)/lib/pkgconfig, they are correctly present

lrwxr-xr-x@ 1 ppc  admin    66B Feb  7 19:41 python-3.13-embed.pc -> ../../Cellar/[email protected]/3.13.2/lib/pkgconfig/python-3.13-embed.pc
lrwxr-xr-x@ 1 ppc  admin    60B Feb  7 19:41 python-3.13.pc -> ../../Cellar/[email protected]/3.13.2/lib/pkgconfig/python-3.13.pc
lrwxr-xr-x@ 1 ppc  admin    62B Feb  7 19:41 python3-embed.pc -> ../../Cellar/[email protected]/3.13.2/lib/pkgconfig/python3-embed.pc
lrwxr-xr-x@ 1 ppc  admin    56B Feb  7 19:41 python3.pc -> ../../Cellar/[email protected]/3.13.2/lib/pkgconfig/python3.pc

How to fix this problem? My python environment is managed by conda, with $PYTHONPATH pointing to $HOME/.conda/envs/myenv/bin. I tried setting $PYTHONPATH to empty or to base environment of conda, but none works.

The answer by @hwinston gives a workaround and it works. I use [email protected] so I only add ENV.append_path "CPATH", "$HOMEBREW_PREFIX/opt/[email protected]/Frameworks/Python.framework/Versions/3.13/include/python3.13/" before resource("gobject-introspection").stage do. Everything works just fine. You may need to use the whole path instead of $HOMEBREW_PREFIX if your homebrew is at a customized location, e.g., /Applications/homebrew in my case.

5 Answers 5

2

First step I found was to install python3.9 since meson depends on it. Then you have to modify glib.rb to add

ENV.append_path "PKG_CONFIG_PATH", HOMEBREW_PREFIX/"lib/pkgconfig"
ENV["CPATH"] = HOMEBREW_PREFIX/"opt/[email protected]/Frameworks/Python.framework/Versions/3.9/include/python3.9"

before resource("gobject-introspection").stage do so pkg-config can find the python3.9.

With these changes I was able to build glib 2.82.5.

Sign up to request clarification or add additional context in comments.

2 Comments

Some further discussion on GH here: github.com/Homebrew/homebrew-core/pull/207900 Still can't seem to install using this method on 3.9 or 3.13
@BillyRyan if it helps you debug, the way I was able to read the log file before it got deleted was to tail -f it. Also, I suspect the python version is the same that is included with command-line tools (/usr/bin/python3 --version) and make sure you are not pulling from the api.
0

I had trouble getting the changes to glib.rb to be used by brew, however setting environment variables worked to make brew install glib succeed:

$ export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/"
$ export CPATH="/usr/local/Cellar/[email protected]/3.13.2/Frameworks/Python.framework/Versions/Current/include/python3.13/"
$ brew install glib
==> Upgrading glib
  2.82.4 -> 2.82.5 
...
==> meson install -C build
🍺  /usr/local/Cellar/glib/2.82.5: 504 files, 35.2MB, built in 5 minutes 41 seconds

1 Comment

Neither yours or changing glib.rb seemed to help in my case. I'm thinking it is likely because I have homebrew installed not in opt or usr/local.
0

I also ran into this issue, trying to upgrade glib to the latest 2.82.5, on a macbookpro running Catalina and python3.13... editing glib.rb did NOT work for me... now I am looking at installing pkg-config-wrapper via brew. Tried many other 'tips', so far no luck yet.

1 Comment

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
0

Other answers did not work for me, but I found another solution.

I installed Xcode, and then the upgrade succeeded.

Additional info:

Environment: MacBook Pro 2016, macOS Monterey
Using `brew upgrade glib -v`, I found that `/usr/bin/python3` was used during the `gobject-introspection` build.

Things I tried (but failed):

  • Changed `PATH` to prioritize `/usr/local/bin/python3`
  • Updated `PKG_CONFIG_PATH` to include `/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/pkgconfig`

Checked `python-3.9.pc`, which had 'prefix=/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9'

  • Changed it to 'prefix=/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9'

Since other formulae required Xcode, I installed Xcode, and that resolved the issue.

One more thing I haven't tried yet:

/usr/bin/python3 -m pip install pkgconfig

might also help.

1 Comment

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
0

Running brew link --overwrite python-setuptools fixed this issue for me, as it appears there was an incomplete brew link due to my homebrew installation being "custom-prefix" (Users/username/usr/local instead of /usr/local due to work laptop restrictions)

Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /Users/username/usr/local
Could not symlink lib/python3.12/site-packages/_distutils_hack/__init__.py
Target /Users/username/usr/local/lib/python3.12/site-packages/_distutils_hack/__init__.py
already exists. You may want to remove it:
  rm '/Users/username/usr/local/lib/python3.12/site-packages/_distutils_hack/__init__.py'

To force the link and overwrite all conflicting files:
  brew link --overwrite python-setuptools

To list all files that would be deleted:
  brew link --overwrite python-setuptools --dry-run

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.