3

This is the command I am trying to run and its output:

$ python2 Python 2.7.8 (default, Sep 24 2014, 18:26:21) [GCC 4.9.1 20140903 (prerelease)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import gi Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.7/site-packages/gi/__init__.py", line 42, in <module> from . import _gi ImportError: /usr/lib/python2.7/site-packages/gi/_gi.so: undefined symbol: g_type_check_instance_is_fundamentally_a 

I have searched for this error, but could not find anything that helped.

These are the packages that I have installed:

$ pacman -Qs python local/pygtk 2.24.0-3 Python bindings for the GTK widget set local/python 3.3.4-1 Next generation of the python high-level scripting language local/python-dbus-common 1.2.0-2 Common dbus-python files shared between python-dbus and python2-dbus local/python-gobject 3.14.0-2 Python 3 bindings for GObject local/python-gobject2 2.28.6-11 Python 3 bindings for GObject2 local/python2 2.7.8-2 A high-level scripting language local/python2-cairo 1.10.0-1 Python2 bindings for the cairo graphics library local/python2-dbus 1.2.0-2 Python 2.7 bindings for DBUS local/python2-distutils-extra 2.38-1 Enhancements to the Python build system local/python2-gobject 3.14.0-2 Python 2 bindings for GObject local/python2-gobject2 2.28.6-11 Python 2 bindings for GObject2 local/python2-pillow 2.3.0-3 Python Imaging Library (PIL) fork. Python2 version. local/python2-xdg 0.25-1 Python library to access freedesktop.org standards 

Dont know what I am missing here..

Solved:

Error was due to older version of glib2 package.

1 Answer 1

5

This might be not a Python problem nor your code problem. /usr/lib/python2.7/site-packages/gi/_gi.so might be corrupted or compiled badly. Maybe you've put it in the wrong path.

How to solve: upgrade glib2

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

5 Comments

@AadityaBagga You might need to uninstall the package '_gi.so' belongs to and reinstall it from official site or using pip; if this doesn't work, download the source and compile it yourself.
The package was python2-gobject, and I had just installed it, so not sure reinstalling will make any difference..
@AadityaBagga 'Undefined symbol' is about your system, not Python. python2-gobject might depend on some package which is not installed.
The dependencies of python2-gobject are installed, as the package manager automatically resolves dependencies.. Perhaps there is an unlisted dependency?
Figured it out: upgrading the glib2 package fixed it ;) Thx for the pointers, marking it as solved; you might want to edit your post to include it.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.