Wednesday, 21 August 2013

Inkscape 0.48.x OS X extensions problem workaround

Problem:

When using extensions with Inkscape 0.48.2 in OS X I get an error similar to: "the fantastic lxml wrapper for libxml2 is required ..." and extensions won't work.

Prerequisites:

This workaround worked on the system it was used on, however the solution is potentially version specific. The versions of stuff installed on this system were:

  • OS X 10.7.5 with the installation of Python that came with it
  • Python 2.7.5 (you can find your version in the terminal by typing "python --version")
  • Fresh install of Inkscape 0.48.2
  • XCode (required to compile the modules that we're going to install)

Notes:

The following steps are not necessarily a permanent fix for this problem, however they worked on the system that they was tested on. Your mileage may vary as the problem seems to be version-specific. Make sure you know what you're doing and follow the instructions at your own risk. If you're unsure, refer to the links in the references for a more complete explanation before starting. Good luck!

Workaround:

This problem is caused by the OS X version of Inkscape not being able to find the version-specific Python module for libxml2 that it was compiled/packaged to use. OS X comes with its own version of python which happens to be missing a few things usually installed in other operating systems. To install the required modules for Inkscape extensions to work, the following steps were taken (though not all may be required for this workaround to succeed.)

This workaround is a combination of two solutions found on internet forums. One of them modifies Inkscape to use version 2.6 of python if it's on the system. (If it is, that modification can be done without installing the libxml modules). The other installs the libxml2 module Inkscape is looking for in version 2.7 of python.

If you're not comfortable with using the terminal, there's an unofficial patch you can install instead of using the below workaround. It can be found at this forum thread: http://boardgamegeek.com/thread/769281/installing-on-osx-lion-the-fantastic-lxml-wrapper (just search for "EggBot2.2.2.r2.mpkg.zip")

Caution: do not proceed if you are not comfortable with the Terminal, command line, or code editing

  • Make sure your install of Inkscape is a fresh, unmodified copy
  • Make sure your python 2 version is at least 2.7.5 (as this workaround was only tested with that version) If it's older, you can get 2.7.5 here: http://www.python.org/download/
  • Open Terminal
  • The following steps may produce errors. If they do, look at the errors and try to fix them to complete the steps before moving on! (The usual: Google if unsure, or do not proceed further)
  • Type the command "sudo easy_install pip" to install the python package manager pip
  • Type the command "sudo pip install virtualenv" (probably not required, but useful)
  • Type the command "sudo pip install lxml"
  • If there are no errors in the above few steps, you're good so far. If there are any errors, try to get the steps to complete without errors (the usual: look at the errors, Google a solution, etc.)
  • In a text editor, open the file "/Applications/Inkscape.app/Contents/Resources/bin/inkscape"
  • Above the line 32 (which reads: "export VERSIONER_PYTHON_PREFER_32_BIT=yes"), add the following line without quotes and save the modified file: "export VERSIONER_PYTHON_VERSION=2.6"
  • (Note that the python version 2.6 specification in the inkscape file may not do anything if version 2.6 isn't on the system, and inkscape may just default to the system's version of python. The above steps to install lxml should make libxml work on the current version of python nonetheless.)
  • Restart Inkscape. The extensions menu should work now.

References:

No comments:

Post a Comment