Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: 'StructMeta' object is not iterable #1087

Closed
ryandesign opened this issue Jun 3, 2020 · 10 comments
Closed

TypeError: 'StructMeta' object is not iterable #1087

ryandesign opened this issue Jun 3, 2020 · 10 comments
Labels
platform.MacOS Issue is reported on MacOS solution.Upstream It's a bug, but not ours

Comments

@ryandesign
Copy link
Contributor

Description of the problem

Hi, I'm the maintainer of MyPaint in MacPorts, finally updating our port to version 2.

I've spent all day figuring out everything that has changed in the build system and getting MyPaint's new set of dependencies up and running while making sure I don't break GIMP's use of libmypaint and mypaint-brushes in the process.

I've finally got everything building but MyPaint does not launch:

$ mypaint
INFO: mypaint: Installation layout: conventional POSIX-like structure with prefix '/opt/local/Library/Frameworks/Python.framework/Versions/3.8'
Traceback (most recent call last):
  File "/opt/local/bin/mypaint", line 293, in <module>
    = get_paths()
  File "/opt/local/bin/mypaint", line 241, in get_paths
    from lib import fileutils
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/mypaint/lib/fileutils.py", line 25, in <module>
    import lib.helpers
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/mypaint/lib/helpers.py", line 22, in <module>
    from lib.gibindings import GdkPixbuf
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/mypaint/lib/gibindings.py", line 29, in <module>
    from gi.repository import Gdk  # noqa
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gi/importer.py", line 145, in load_module
    importlib.import_module('gi.repository.' + dep.split("-")[0])
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gi/importer.py", line 145, in load_module
    importlib.import_module('gi.repository.' + dep.split("-")[0])
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gi/importer.py", line 145, in load_module
    importlib.import_module('gi.repository.' + dep.split("-")[0])
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gi/importer.py", line 146, in load_module
    dynamic_module = load_overrides(introspection_module)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gi/overrides/__init__.py", line 125, in load_overrides
    override_mod = importlib.import_module(override_package_name)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gi/overrides/GLib.py", line 86, in <module>
    class _VariantCreator(object):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gi/overrides/GLib.py", line 89, in _VariantCreator
    'b': GLib.Variant.new_boolean,
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gi/module.py", line 221, in __getattr__
    wrapper = metaclass(name, bases, dict_)
TypeError: 'StructMeta' object is not iterable

I'm afraid Python and its error messages baffle me so I don't know what to do.

Basic system details

MyPaint version: 2.0.1
Operating system: macOS 10.13.6
Desktop environment: X11

Steps to reproduce

  1. Build and install MyPaint on macOS. I used these commands, flags and environment variables:
:debug:build Environment: 
:debug:build CC='/usr/bin/clang'
:debug:build CC_PRINT_OPTIONS='YES'
:debug:build CC_PRINT_OPTIONS_FILE='/opt/local/var/macports/build/_Users_rschmidt_macports_macports-ports-svn-trunk-new_graphics_MyPaint/MyPaint/work/.CC_PRINT_OPTIONS'
:debug:build CFLAGS='-arch x86_64 -isysroot/'
:debug:build CPATH='/opt/local/include'
:debug:build CXX='/usr/bin/clang++'
:debug:build CXXFLAGS='-arch x86_64 -stdlib=libc++ -isysroot/'
:debug:build DEVELOPER_DIR='/Library/Developer/CommandLineTools'
:debug:build F90FLAGS='-m64'
:debug:build FCFLAGS='-m64'
:debug:build FFLAGS='-m64'
:debug:build LDFLAGS='-arch x86_64'
:debug:build LIBRARY_PATH='/opt/local/lib'
:debug:build MACOSX_DEPLOYMENT_TARGET='10.13'
:debug:build OBJC='/usr/bin/clang'
:debug:build OBJCFLAGS='-arch x86_64 -isysroot/'
:debug:build PKG_CONFIG_PATH='/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/pkgconfig'
:info:build Executing:  cd "/opt/local/var/macports/build/_Users_rschmidt_macports_macports-ports-svn-trunk-new_graphics_MyPaint/MyPaint/work/mypaint-2.0.1" && /opt/local/Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 setup.py --no-user-cfg build -j8 
:debug:destroot Environment: 
:debug:destroot CC='/usr/bin/clang'
:debug:destroot CC_PRINT_OPTIONS='YES'
:debug:destroot CC_PRINT_OPTIONS_FILE='/opt/local/var/macports/build/_Users_rschmidt_macports_macports-ports-svn-trunk-new_graphics_MyPaint/MyPaint/work/.CC_PRINT_OPTIONS'
:debug:destroot CFLAGS='-arch x86_64 -isysroot/'
:debug:destroot CPATH='/opt/local/include'
:debug:destroot CXX='/usr/bin/clang++'
:debug:destroot CXXFLAGS='-arch x86_64 -stdlib=libc++ -isysroot/'
:debug:destroot DEVELOPER_DIR='/Library/Developer/CommandLineTools'
:debug:destroot F90FLAGS='-m64'
:debug:destroot FCFLAGS='-m64'
:debug:destroot FFLAGS='-m64'
:debug:destroot LDFLAGS='-arch x86_64'
:debug:destroot LIBRARY_PATH='/opt/local/lib'
:debug:destroot MACOSX_DEPLOYMENT_TARGET='10.13'
:debug:destroot OBJC='/usr/bin/clang'
:debug:destroot OBJCFLAGS='-arch x86_64 -isysroot/'
:debug:destroot PKG_CONFIG_PATH='/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/pkgconfig'
:info:destroot Executing:  cd "/opt/local/var/macports/build/_Users_rschmidt_macports_macports-ports-svn-trunk-new_graphics_MyPaint/MyPaint/work/mypaint-2.0.1" && /opt/local/Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 setup.py --no-user-cfg install --prefix=/opt/local/Library/Frameworks/Python.framework/Versions/3.8 --root=/opt/local/var/macports/build/_Users_rschmidt_macports_macports-ports-svn-trunk-new_graphics_MyPaint/MyPaint/work/destroot 
@jplloyd
Copy link
Member

jplloyd commented Jun 3, 2020

I'm not sure, but this might be a "module not found" error in disguise. The problem is that it fails to load the bindings for Gdk, but I'm not sure why.

First make sure that Gdk-2.0.typelib is installed. If it is not, installing it should hopefully fix the problem (can't help you with which macport package it would be in). You also need the introspection bindings for
GdkPixbuf
Gio
GLib
GObject
Gtk
Pango
PangoCairo

I think most of these would be part of the same package.

@ryandesign
Copy link
Contributor Author

Are these the ones?

$ ls -l /opt/local/lib/girepository-1.0/ | grep -E ' (Gdk|GdkPixbuf|Gio|GLib|GObject|Gtk|Pango|PangoCairo)-'
-rw-r--r--  1 root  wheel  190368 Mar 12 08:48 GLib-2.0.typelib
-rw-r--r--  1 root  wheel   58876 Mar 12 08:48 GObject-2.0.typelib
-rw-r--r--  1 root  wheel  239476 Jul 18  2018 Gdk-2.0.typelib
-rw-r--r--  1 root  wheel  235348 May  3 16:43 Gdk-3.0.typelib
-rw-r--r--  1 root  wheel   16308 Mar 12 08:48 GdkPixbuf-2.0.typelib
-rw-r--r--  1 root  wheel  344772 Mar 12 08:48 Gio-2.0.typelib
-rw-r--r--  1 root  wheel  584276 Jul 18  2018 Gtk-2.0.typelib
-rw-r--r--  1 root  wheel  677028 May  3 16:43 Gtk-3.0.typelib
-rw-r--r--  1 root  wheel   63372 Apr 20 00:08 Pango-1.0.typelib
-rw-r--r--  1 root  wheel    5408 Apr 20 00:08 PangoCairo-1.0.typelib

@jplloyd
Copy link
Member

jplloyd commented Jun 3, 2020

Yes, so they are installed.

If you can run this:

python3 -c 'import gi; from gi.repository import Gdk'

and only get the warning about the version being unspecified, there may be something we need to fix in our code. If you get the same error as before, try running:

GI_TYPELIB_PATH=/opt/local/lib/girepository-1.0 python3 -c 'import gi; from gi.repository import Gdk'

If that works, I think it would suggest a configuration issue in macports.

@ryandesign
Copy link
Contributor Author

Thanks for the suggestion. Both of those still generate the same errors.

@ryandesign
Copy link
Contributor Author

I have been using python3.8 because it is the latest. If I use python3.7 instead, then your above tests succeed. I can try building MyPaint with python3.7 instead.

@ryandesign
Copy link
Contributor Author

And MyPaint is working with python3.7. So that's fantastic! Of course it would be nice to figure out why python3.8 is being different.

@jplloyd
Copy link
Member

jplloyd commented Jun 3, 2020

Nice, maybe pygobject was not updated to the latest version (don't know if that should be necessary)?

Seems this is a known problem: https://gitlab.gnome.org/GNOME/pygobject/-/issues/375

@jplloyd jplloyd added platform.MacOS Issue is reported on MacOS solution.Upstream It's a bug, but not ours labels Jun 3, 2020
@ryandesign
Copy link
Contributor Author

Good find! I see MacPorts also has a bug report for this at https://trac.macports.org/ticket/60413. I will see if I can get in touch with our py-gobject3 maintainer about updating the port and I'll stick with python3.7 for MyPaint for now. Thanks for your help tracking this down.

@jplloyd
Copy link
Member

jplloyd commented Jun 3, 2020

No problem, and thank you for helping mac users use MyPaint. I'll close this since it's an upstream issue we can't really work around on our end.

@jplloyd jplloyd closed this as completed Jun 3, 2020
@ryandesign
Copy link
Contributor Author

We updated py-gobject3 from 3.28.3 to 3.36.1 and I can't reproduce this problem now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform.MacOS Issue is reported on MacOS solution.Upstream It's a bug, but not ours
Development

No branches or pull requests

2 participants