15

import glib fails with:

ImportError: /usr/lib/python2.7/dist-packages/glib/_glib.so: undefined symbol: PyUnicodeUCS4_DecodeUTF8

How can I fix this?

Python version is Python 2.7.3rc2. The OS is Debian.

Senthil
  • 1,244
  • 10
  • 25
blues
  • 4,547
  • 3
  • 23
  • 39

1 Answers1

25

The module was built against a Python that was built with UCS-4 as its internal unicode representation. Your Python was built with UCS-2 as its internal representation. Rebuild the module, or rebuild Python.

This issue is mentioned in the official FAQ. This is discussed in-depth in python issue 8654.

André Laszlo
  • 15,169
  • 3
  • 63
  • 81
Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358
  • 1
    If possible I would prefer to have my package manager replace it instead of building it myself but I suppose that's another question. – blues Jun 01 '13 at 11:14
  • 2
    I highly suspect that the package manager wasn't involved with installing that version of Python in the first place. – Ignacio Vazquez-Abrams Jun 01 '13 at 11:15
  • This is also mentioned in [the official FAQ](http://docs.python.org/2.7/faq/extending.html#when-importing-module-x-why-do-i-get-undefined-symbol-pyunicodeucs2). This is discussed in-depth [in this python issue 8654](http://bugs.python.org/issue8654). – JamesThomasMoon Jan 09 '14 at 20:41
  • How I build Python with UCS-4? – Dan Bolser Nov 28 '17 at 16:08