Fixing Inkscape Python extensions

05 lipca 2010 23:20:11 | Kategorie: Apple OpenSource Techblog

Inkscape actually is a nice program. Maybe some of the competition (like Omnigraffle) are nicer. But then again, Inkscape beats them with the fact that it's free. It also has a lot of useful extensions (like Textext). Unfortunately, they managed to break the whole Python extension mechanism for 64bit OS X.

The exact error message was always:

The fantastic lxml wrapper for libxml2 is required by inkex.py and therefore this extension. Please download and install the latest version from http://cheeseshop.python.org/pypi/lxml/, or install it through your package manager by a command like: sudo apt-get install python-lxml

And of course none of the hints found on Google helped...

Of course the first thing I tried was installing the lxml module. To no avail. I have multiple Python installations in my system, so I continued with installing it for every one of them. Still, nothing. Following some hints I tried fiddling with libxml2 and other libraries. No effect.

It turns out, that Inkscape team tried to be nice and Mac style, so they bundled the extensions by themselves. The problem is: lxml/etree.so: Mach-O bundle i386 This would not be that bad, as: /usr/bin/python: Mach-O universal binary with 3 architectures /usr/bin/python (for architecture x86_64): Mach-O 64-bit executable x86_64 /usr/bin/python (for architecture i386): Mach-O executable i386 /usr/bin/python (for architecture ppc7400): Mach-O executable ppc Which should be used by a program, that wants a standard framework. Unfortunately they happily run whatever is first in the path, ending up with my custom 64bit only interpreter. Which can't load the 32bit only library they provide.

The only remaining quirk is the misleading error message. This is due to the simple code:

try:
    from lxml import etree
except Exception, e:
    sys.exit(_('The fantastic lxml wrapper for libxml2 is required by inkex.py and therefore this extension. Please download and install the latest version from http://cheeseshop.python.org/pypi/lxml/, or install it through your package manager by a command like: sudo apt-get install python-lxml'))

That was created probably way before the decision to include lxml. But since that it's not valid any more...

Being a good child I added my findings about the problem to the long time open Launchpad bug and suggested fixing the error message.

Anyhow, the fix is as simple as: rm -r /Applications/Inkscape.app/Contents/Resources/python This gets rid of all the broken Inkscape bundled python stuff. In case you don't already have the modules installed, then run: easy_install lxml easy_install numpy

Komentarze do notki Fixing Inkscape Python extensions

  • riddle dnia 06 lipca 2010 o 00:12:24:

    I hate when people do this instead of actually contributing something valuable, but may I just suggest adding "pre { white-space: pre-wrap; } to template’s CSS?

  • Remigiusz 'lRem' Modrzejewski dnia 06 lipca 2010 o 00:17:16:

    Well, I never cared about this theme because it's meant to be temporary ;)

    Anyhow, good hint, implemented. Thanks :)

  • Mark dnia 04 stycznia 2012 o 20:44:17:

    It's going to be officially fixed in 0.48.3 for Mac OS X 10.7. :D

    https://bugs.launchpad.net/inkscape/+bug/819209

    PS: "Dodaj komentarz"? maybe it would be better/nicer to have comment form descriptions in English... :D

  • Mark dnia 04 stycznia 2012 o 20:44:33:

    It's going to be officially fixed in 0.48.3 for Mac OS X 10.7. :D

    https://bugs.launchpad.net/inkscape/+bug/819209

    PS: "Dodaj komentarz"? maybe it would be better/nicer to have comment form descriptions in English... :D

  • Remigiusz 'lRem' Modrzejewski dnia 05 stycznia 2012 o 15:33:25:

    Yeah, if this blog was primarily in English that would be nice ;)

Komentuj Dodaj komentarz: