Closed Amar1729 closed 1 month ago
I had this same error after doing a brew upgrade
yesterday at around 20:00 UTC, which upgraded my deluge-meta to the 2.1.1_3 version now at the HEAD of this repo. Today I ran brew doctor
and it told me:
Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause formulae that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
glib
When I ran brew link
, the error went away but a new one came in its place:
$ deluge
07:54:48 [ERROR ][deluge.ui.gtk3 :52 ] 'gi.repository.Gio' object has no attribute 'content_type_get_icon'
Traceback (most recent call last):
File "/opt/homebrew/Cellar/deluge-meta/2.1.1_3/libexec/lib/python3.12/site-packages/deluge/ui/gtk3/__init__.py", line 49, in run
gtkui = GtkUI(options)
^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/deluge-meta/2.1.1_3/libexec/lib/python3.12/site-packages/deluge/ui/gtk3/gtkui.py", line 200, in __init__
self.torrentdetails = TorrentDetails()
^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/deluge-meta/2.1.1_3/libexec/lib/python3.12/site-packages/deluge/ui/gtk3/torrentdetails.py", line 124, in __init__
from .files_tab import FilesTab
File "/opt/homebrew/Cellar/deluge-meta/2.1.1_3/libexec/lib/python3.12/site-packages/deluge/ui/gtk3/files_tab.py", line 47, in <module>
G_ICON_DIRECTORY = Gio.content_type_get_icon('inode/directory')
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.12/site-packages/gi/overrides/__init__.py", line 32, in __getattr__
return getattr(self._introspection_module, name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.12/site-packages/gi/module.py", line 126, in __getattr__
raise AttributeError("%r object has no attribute %r" % (
AttributeError: 'gi.repository.Gio' object has no attribute 'content_type_get_icon'
Traceback (most recent call last):
File "/opt/homebrew/Cellar/deluge-meta/2.1.1_3/libexec/bin/deluge", line 8, in <module>
sys.exit(start_ui())
^^^^^^^^^^
File "/opt/homebrew/Cellar/deluge-meta/2.1.1_3/libexec/lib/python3.12/site-packages/deluge/ui/ui_entry.py", line 140, in start_ui
ui.start()
File "/opt/homebrew/Cellar/deluge-meta/2.1.1_3/libexec/lib/python3.12/site-packages/deluge/ui/gtk3/__init__.py", line 55, in start
deluge.common.run_profiled(
File "/opt/homebrew/Cellar/deluge-meta/2.1.1_3/libexec/lib/python3.12/site-packages/deluge/common.py", line 1355, in run_profiled
return func(*args)
^^^^^^^^^^^
File "/opt/homebrew/Cellar/deluge-meta/2.1.1_3/libexec/lib/python3.12/site-packages/deluge/ui/gtk3/__init__.py", line 49, in run
gtkui = GtkUI(options)
^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/deluge-meta/2.1.1_3/libexec/lib/python3.12/site-packages/deluge/ui/gtk3/gtkui.py", line 200, in __init__
self.torrentdetails = TorrentDetails()
^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/deluge-meta/2.1.1_3/libexec/lib/python3.12/site-packages/deluge/ui/gtk3/torrentdetails.py", line 124, in __init__
from .files_tab import FilesTab
File "/opt/homebrew/Cellar/deluge-meta/2.1.1_3/libexec/lib/python3.12/site-packages/deluge/ui/gtk3/files_tab.py", line 47, in <module>
G_ICON_DIRECTORY = Gio.content_type_get_icon('inode/directory')
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.12/site-packages/gi/overrides/__init__.py", line 32, in __getattr__
return getattr(self._introspection_module, name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.12/site-packages/gi/module.py", line 126, in __getattr__
raise AttributeError("%r object has no attribute %r" % (
AttributeError: 'gi.repository.Gio' object has no attribute 'content_type_get_icon'
Oh dang, good call on brew doctor
, it looks like glib
was also unlinked for me (how did that happen??). Yeah, i now see the same error as you when running deluge
/deluge-gtk
, which i assume is a dependency version problem somewhere. might have to pin something.
Ok, I think this is actually because something has changed in upstream gobject-introspection
, as filed in this brew issue: https://github.com/Homebrew/homebrew-core/issues/167524
So, waiting on that fix before this can be addressed. It's also somewhat non-trivial to test locally, because gobject-introspection won't currently build locally for me because i have the recent commandline tools update.
Ok, i've fleshed out the required process for anybody running into this issue. It's a bit involved, but boils down to the following:
glib
/gobject-introspection
gobject-introspection
writes some files to glib
's keg location.homebrew/homebrew-core
deluge-meta
, which will use the last working gobject-introspection
(v1.78.1
)gobject-introspection
and reinstall your packagesglib
This step is helpful if you (like me) have several packages dependent on glib
. We will later use the output to re-install anything you uninstall here.
brew uninstall deluge-meta
brew autoremove
comm -1 -2 <(brew leaves | sort) <(brew uses --installed glib | sort) > pkgs.txt
comm -1 -2 <(brew leaves | sort) <(brew uses --installed gobject-introspection | sort) >> pkgs.txt
# look at the output of pkgs.txt (should be one package per line), then uninstall all of them:
cat pkgs.txt | xargs brew uninstall
brew autoremove
# this should succeed, since we've now removed anything that depends on glib (including gobject-introspection).
brew uninstall glib
gobject-introspection
v1.78.1
# ensure you have homebrew/homebrew-core tapped locally:
brew tap homebrew/homebrew-core
# then rewind it to here:
# (you can find this commit yourself by doing `git log -- Formula/g/gobject-introspection.rb` in its git directory, and looking for the last commit that uses gobject-introspection 1.78.1)
git -C "$(brew --prefix)"/Library/Taps/homebrew/homebrew-core checkout abdcdb4613d762c58b0d59ae97f34e92e00f493d
deluge-meta
IMPORTANT: during this step, you must set an environment variable to ensure homebrew doesn't by-default update your dependencies to their current versions based on an API call (it does this by default because it generally is a latest-version-only package manager).
# delete the cached data of up-to-date packages (just for safety, i dont think this is actually necessary)
rm "$(brew --cache)"/api/formula.jws.json
# now install
# keep an eye on what gets installed as this runs:
# it SHOULD install gobject-introspection 1.78.1 and glib 2.80.0.
HOMEBREW_NO_INSTALL_FROM_API=1 brew install amar1729/deluge-meta/deluge-meta
# test that this works by launching the GUI:
deluge # or deluge-gtk
This will stop gobject-introspection
from being upgraded by homebrew, but importantly it will also stop all of its dependents from being upgraded. You will likely want to unpin this as soon as possible (when the object issue is fixed).
cat pkgs.txt | HOMEBREW_NO_INSTALL_FROM_API=1 xargs brew install
brew pin gobject-introspection glib
# there may be other formulae to pin here, i'm not sure ...
# i'm worried you have to pin python@3.12 itself, which would be annoying
You may restore the homebrew/homebrew-core tap to normal with:
git -C "$(brew --prefix)"/Library/Taps/homebrew/homebrew-core checkout master
Or, you may delete it: brew untap homebrew/homebrew-core
. Any future brew operations will go back to using the API (unless you set HOMEBREW_NO_INSTALL_FROM_API
in your shell profile). Remember you can use brew upgrade --formula --dry-run
to check what will happen before actually running the upgrade.
PS. I don't really understand why, but homebrew seems to lose track of the versions of pinned packages. After resetting back to current homebrew/homebrew-core origin/master
and running brew upgrade --formulae --dry-run
, brew
seems to think that i have glib 2.80.0_2, gobject-introspection 1.80.1
(the current versions) even though i pinned at 2.80.0
and 1.78.1
, respectively.
run brew upgrade
at your peril! π¬
Came up with a bit of a hacky two-liner to find all packages safe to upgrade:
# takes more time if you have more things dependent on glib (~1min for me)
brew uses --installed --recursive glib | tee glib-related.txt | xargs -n1 brew deps | sort -u >> glib-related.txt
# inspect the final output and see what brew says it will upgrade
# if you're ok with it you can re-run and remove --dry-run, or do it manually with brew upgrade pkg1 [pkg2 ...]
comm -1 -3 <(sort glib-related.txt) <(brew outdated --formula | awk '{print $1}' | grep -v "^glib$" | sort) | xargs brew upgrade --dry-run
I ran the two-liner, while deluge-meta
was installed, but it did not upgrade deluge-meta
π€
@cipri-tom that makes sense: deluge-meta
should be marked as unsafe to upgrade since it depends on glib
. Besides, there are no upgrades for it yet - if you've done the in-depth required process above, you should have the most up-to-date version.
*just thought of a possible inconsistency: maybe try changing into this tap repo's directory and doing git pull
to ensure it's up-to-date before doing step 3 ("install deluge meta")?
here: "$(brew --prefix)"/Library/Taps/amar1729/homebrew-deluge-meta
thanks for your work @Amar1729. I tried your instructions but couldn't get it working on my m2 but these below worked for me.
remove glib, gobject-introspection and other dependencies:
curl https://raw.githubusercontent.com/Homebrew/homebrew-core/abdcdb4613d762c58b0d59ae97f34e92e00f493d/Formula/g/gobject-introspection.rb > gobject-introspection.rb
brew install gobject-introspection.rb
curl https://raw.githubusercontent.com/Homebrew/homebrew-core/0cab8027f59e1ec78e45303f7d3d3feb97c51072/Formula/g/glib.rb > glib.rb
brew install glib.rb
brew install amar1729/deluge-meta/deluge-meta
Hello, I have been frustrated by this problem. I have tried following all the steps outlined in the different posts of this thread without success. Whatever I do, it still goes for the latest package.
Is there any further guidance or advice that could help?
I know this will be fixed in brew eventually, but I checking everyday, so getting the workaround to work would help me a lot.
Thanks!
I don't know if the fix in brew will be anytime soon. The issue is closed. They deferred to Gnome, which doesn't seem to have a resolution or action plan. To it may be a while before a fix lands
as far i know brew now use its api to determine current version of package
have you set environment variable HOMEBREW_NO_INSTALL_FROM_API=1
to use git?
as far i know brew now use its api to determine current version of package have you set environment variable
HOMEBREW_NO_INSTALL_FROM_API=1
to use git?
Yes, I copy and paste the commands, though some modifications were required.
For example, I need to add --force
brew tap homebrew/homebrew-core
and then
I need to add /Homebrew
before Library in git -C "$(brew --prefix)"/Library/Taps/homebrew/homebrew-core checkout abdcdb4613d762c58b0d59ae97f34e92e00f493d
other than that, running HOMEBREW_NO_INSTALL_FROM_API=1 brew install amar1729/deluge-meta/deluge-meta
installs, but it uses 1.80.1 of gobject-introspection...
Am I missing a step? Thanks for any guidance here
β ~ brew uninstall deluge-meta
Error: No such keg: /usr/local/Cellar/deluge-meta
β ~ brew autoremove
β ~ comm -1 -2 <(brew leaves | sort) <(brew uses --installed glib | sort) > pkgs.txt
β ~ comm -1 -2 <(brew leaves | sort) <(brew uses --installed gobject-introspection | sort) >> pkgs.txt
β ~ cat pkgs.txt | xargs brew uninstall
β ~ brew autoremove
β ~ brew uninstall glib
Error: No such keg: /usr/local/Cellar/glib
β ~ brew tap homebrew/homebrew-core --force
β ~ git -C "$(brew --prefix)"/Homebrew/Library/Taps/homebrew/homebrew-core checkout abdcdb4613d762c58b0d59ae97f34e92e00f493d
Previous HEAD position was 5f1509692b4 Merge pull request #170182 from chromy/add-task2
HEAD is now at abdcdb4613d gobject-introspection: update 1.78.1 bottle.
β ~ rm "$(brew --cache)"/api/formula.jws.json
Hello, I have been frustrated by this problem. I have tried following all the steps outlined in the different posts of this thread without success. Whatever I do, it still goes for the latest package.
Is there any further guidance or advice that could help?
I know this will be fixed in brew eventually, but I checking everyday, so getting the workaround to work would help me a lot.
Thanks!
I had the same problem. For me, the issue was that homebrew auto-updated whenever I ran the install command. I fixed it by turning auto-update off:
HOMEBREW_NO_INSTALL_FROM_API=1 HOMEBREW_NO_AUTO_UPDATE=1 brew install amar1729/deluge-meta/deluge-meta
Hello, I have been frustrated by this problem. I have tried following all the steps outlined in the different posts of this thread without success. Whatever I do, it still goes for the latest package. Is there any further guidance or advice that could help? I know this will be fixed in brew eventually, but I checking everyday, so getting the workaround to work would help me a lot. Thanks!
I had the same problem. For me, the issue was that homebrew auto-updated whenever I ran the install command. I fixed it by turning auto-update off:
HOMEBREW_NO_INSTALL_FROM_API=1 HOMEBREW_NO_AUTO_UPDATE=1 brew install amar1729/deluge-meta/deluge-meta
Brilliant. That worked right away. Thank you!
Hi, if I understand correctly, for now, we should always use HOMEBREW_NO_INSTALL_FROM_API=1 HOMEBREW_NO_AUTO_UPDATE=1
for every brew install commands ?
Ty.
@acuD1 at least for the install commands for this formula, yes (and i think i just set HOMEBREW_NO_AUTO_UPDATE=1
globally anyway).
so, glib 2.82 is now on brew. Does this fix this issue?
https://github.com/Homebrew/homebrew-core/pull/182682
Edit: I have deluge-gtk working now.
For some reason python-typing has been disabled in brew: https://formulae.brew.sh/formula/python-typing-extensions I had to remove that from the brew recipe for deluge-meta and install version 4.12.2 with pip.
So here is my history:
brew tap amar1729/deluge-meta
brew install deluge-meta
brew install python@3.12
brew edit deluge-meta
/usr/local/opt/deluge-meta/libexec/bin/python3 -m ensurepip
/usr/local/opt/deluge-meta/libexec/bin/python3 -m pip install typing-extensions
brew install deluge-meta
deluge-gtk
Happily, I think the updated glib does fix the issue. Waiting on linked PR to close this as it doesn't technically build right now.
Since various updates to formulae and dependencies (python3.12? libtorrent / pygobject bindings?), launching
deluge-gtk
now results in this error:However, running
/opt/homebrew/opt/deluge-meta/libexec/bin/python -c 'import gi.repository'
successfully completes, so it's justGLib
that's not being found? I need to track down what formula provides it: internet seems to indicategir1.2-gtk-3.0
on ubuntu, which of course isn't a thing on mac. this formula does depend ongtk+3
, and yet something's still broken ...