Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 924747 - media-gfx/inkscape-1.3.2 fails to find dev-python/lxml at runtime
Summary: media-gfx/inkscape-1.3.2 fails to find dev-python/lxml at runtime
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Andreas K. Hüttel
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 923255
  Show dependency tree
 
Reported: 2024-02-17 06:12 UTC by Matt Whitlock
Modified: 2024-03-12 00:53 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Whitlock 2024-02-17 06:12:20 UTC
[ebuild   R   ] dev-python/lxml-4.9.4  USE="threads -debug -doc -examples -test" PYTHON_TARGETS="python3_11 -pypy3 -python3_10 -python3_12" 
[ebuild   R   ] media-gfx/inkscape-1.3.2  USE="X exif jpeg readline -cdr -dia -graphicsmagick -imagemagick -inkjar -openmp -postscript -sourceview -spell -svg2 -test -visio -wpg" PYTHON_SINGLE_TARGET="python3_11 -python3_10" 

Both Inkscape and lxml are installed for Python 3.11 only, yet Inkscape fails to find lxml at runtime when I attempt to use the "Optimized SVG" output extension:

Traceback (most recent call last):
  File "/usr/share/inkscape/extensions/output_scour.py", line 7, in <module>
    import inkex
  File "/usr/share/inkscape/extensions/inkex/__init__.py", line 11, in <module>
    from .extensions import *
  File "/usr/share/inkscape/extensions/inkex/extensions.py", line 34, in <module>
    from .elements import (
  File "/usr/share/inkscape/extensions/inkex/elements/__init__.py", line 9, in <module>
    from ._parser import SVG_PARSER, load_svg
  File "/usr/share/inkscape/extensions/inkex/elements/_parser.py", line 30, in <module>
    from lxml import etree
ModuleNotFoundError: No module named 'lxml'

It appears that Inkscape is executing Python scripts in /usr/share/inkscape/extensions/ without EPYTHON having been set in the environment. Thus, when python-exec's global default python3 interpreter is Python 3.12, these scripts are interpreted under Python 3.12, and thus they can't find their dependencies, which are installed for Python 3.11 only.

Shouldn't there be some wrapper when launching Inkscape that sets EPYTHON to the correct value corresponding to the active PYTHON_SINGLE_TARGET so that any Python scripts executed by Inkscape will exec the correct python3 interpreter version?
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-02-17 06:14:20 UTC
inkscape uses python-single-r1, so python_fix_shebang or similar needs to be used on its installed scripts.
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-02-17 06:15:01 UTC
(In reply to Sam James from comment #1)
> inkscape uses python-single-r1, so python_fix_shebang or similar needs to be
> used on its installed scripts.

.. if there's no shebang on them (can't check right now), and inkscape is doing something else (if it does, say, python /path/to/foo.py), then ofc a different strategy may be needed
Comment 3 Matt Whitlock 2024-02-17 07:00:11 UTC
I can confirm that launching Inkscape using the command line "EPYTHON=python3.11 inkscape" does allow the plugin to work as expected. Munging the shebang lines in the extension scripts (yes, they do have them) would probably also work, but I haven't tried it.
Comment 4 Larry the Git Cow gentoo-dev 2024-03-12 00:52:38 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8f3867c8f2e4b1f7dcaa0c2e19812b3133bed141

commit 8f3867c8f2e4b1f7dcaa0c2e19812b3133bed141
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2024-03-12 00:49:40 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-03-12 00:52:22 +0000

    media-gfx/inkscape: fix Python dependencies & shebangs
    
    * Fix Python dependency (needs pillow for jpeg/tiff/webp at least)
    * Fix shebangs on Python extensions so we respect PYTHON_SINGLE_TARGET
    
    Closes: https://bugs.gentoo.org/924747
    Closes: https://bugs.gentoo.org/922320
    Signed-off-by: Sam James <sam@gentoo.org>

 media-gfx/inkscape/inkscape-1.3.2-r1.ebuild | 208 ++++++++++++++++++++++++++++
 media-gfx/inkscape/inkscape-9999.ebuild     |   5 +-
 2 files changed, 210 insertions(+), 3 deletions(-)