30/04/2020: Configurar Inkscape para nuevas extensiones

Última actualización: 30/04/2020 19:08 (Europe/Madrid) - English version (if available) below


Una de las opciones más interesantes de Inkscape es la posibilidad de crear tus propias extensiones para aplicar efectos o transformaciones a tus diseños. Las extensiones pueden programarse en cualquier lenguaje de programación, aunque los más habitual es hacerlo en Python. En la próxima versión de Inkscape (la 1.0) por fin se podrá usar Python 3. Hasta ahora las extensiones solo podían usar Python 2 lo cual era ciertamente un problema porque a esa versión ya no se le da soporte.

He instalado la versión candidata (última versión antes de sacar la 1.0) y he tenido que hacer un par de cambios para poder usar directamente las extensiones con Python 3, ya que en mi sistema (Ubuntu 18.04) están instaladas tanto la versión 3 como la 2 y el intérprete por defecto python que es el que usa Inkscape es el 2.

Primero tuve que indicarle a Inkscape la versión del interprete a usar (python3):

# ~/.config/inkscape/preferences.xml
# Añadir línea "python-interpreter"
...
<group
     id="extensions"
     python-interpreter="/usr/bin/python3"
...

Además tuve que intalar el paquete de python lxml (necesario para las extensiones de Inkscape):

> pip install lxml

Y opcionalmente instalé el paquete svgpathtools que lo utilizo en varias extensiones propias mías:

> pip install svgpathtools

One of the most interesting options in Inkscape is the posibility of creating your own extensions to apply effects or transformations to your designs. The extensions can be programmed in any programming language but the most usual is Python. In the next Inkscape release (1.0) extensions could be programmed in Python 3. Until now, extensions could only use Python 2 which was a real hassle because that version will not receive more support.

I have installed the latest release candidate verion of Inkscape (which will become Inkscape 1.0) and I had to do some changes to be make Inkscape use Python 3 as my system (Ubuntu 18.04) has both Python 2 and 3 installed and the default python interpreter (the one used by Inkscape) is the old version 2.

First I had to tell Inkscape to use the correct interpreter to use (python3):

# ~/.config/inkscape/preferences.xml
# Add the line "python-interpreter"
...
<group
     id="extensions"
     python-interpreter="/usr/bin/python3"
...

In addition I had to install the python package lxml (which is important for Inkscape's extensions):

> pip install lxml

Moreover (and this is optional) I installed the package svgpathtools which I usually use in my own extensions:

> pip install svgpathtools

Otras entradas del blog: