I'm trying to use gtk+ with python in Linux Mint 17. After trying the jhbuild method of building the gtk libraries for python, I tried to install from the Debian repositories and I tried to install with pip. Somewhere in the midst of that mess, I built two versions of gi for python. One of them sits in the /usr/local/lib/python2.7/dist-packages directory and the other in the /usr/lib/python2.7/dist-packages directory. When trying to import gi.repository, I get the error:

ImportError: /usr/lib/python2.7/dist-packages/gi/_gi.so: undefined symbol: PyUnicodeUCS4_FromUnicode

PyUnicodeUCS4_FromUnicode is defined in both the /usr/include/python2.7/unicodeobject.h file and in the /usr/local/python2.7 directory. How can I get python to find when importing gi.repository?

closed as off-topic by muru, Fabby, Charles Green, Pilot6, hg8 Nov 23 '15 at 9:13

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This is not about Ubuntu. Questions about other Linux distributions can be asked on Unix & Linux, those about Windows on Super User, those about Apple products on Ask Different and generic programming questions on Stack Overflow." – muru, Fabby, Charles Green, Pilot6, hg8
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Header files don't define symbols: you need to find the actual library file. BTW Mint is usually considered off-topic here. – steeldriver Aug 28 '15 at 11:42
  • Questions on Mint should be asked on Unix & Linux. – muru Nov 22 '15 at 20:55

Python was compiled with 2-byte representations of unicode characters instead of 4-byte representations. Fix by re-configuring with

./configure --enable-unicode=ucs4

See the following: http://effbot.org/pyfaq/when-importing-module-x-why-do-i-get-undefined-symbol-pyunicodeucs2.htm

Not the answer you're looking for? Browse other questions tagged or ask your own question.