0.92.3 does not appear to install lxml correctly

Bug #1783019 reported by Halibut Hippo
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Inkscape
Invalid
Undecided
Unassigned

Bug Description

I've been struggling with a problem since installing 0.92.3, which is that I am getting the 'the fantastic lxml is missing' error, which has been reported numerous times. However, the 'fixes' for the other reports that I have found have not worked.

The system is Windows 7 x64. Inkscape is Inkscape 0.92.3 (2405546, 2018-03-11).

I have uninstalled all non-Inkscape Pythons on my system, and have deleted ( via Programs and Features ) Inkscape and reinstalled it. I'm using the .msi file. The symptoms remain the same. When I attempt to view help, or to export to dxf, I get the missing lxml error.

The error appears to be accurate. Here is the output of SysInternals ProcMon, that shows what Inkscape ( or at least, python ) is looking for ( I've truncated the Options section ):

20:38:47.3365628 pythonw.exe 5952 CreateFile C:\Program Files\Inkscape\share\extensions\lxml NAME NOT FOUND Desired Access: Read Attributes, Disposition: Open, Options:
20:38:47.3366958 pythonw.exe 5952 CreateFile C:\Program Files\Inkscape\share\extensions\lxml.pyd NAME NOT FOUND Desired Access: Generic Read, Disposition: Open,
20:38:47.3368453 pythonw.exe 5952 CreateFile C:\Program Files\Inkscape\share\extensions\lxml.py NAME NOT FOUND Desired Access: Generic Read, Disposition: Open,
20:38:47.3369696 pythonw.exe 5952 CreateFile C:\Program Files\Inkscape\share\extensions\lxml.pyw NAME NOT FOUND Desired Access: Generic Read, Disposition: Open,
20:38:47.3370901 pythonw.exe 5952 CreateFile C:\Program Files\Inkscape\share\extensions\lxml.pyc NAME NOT FOUND Desired Access: Generic Read, Disposition: Open,
20:38:47.3372865 pythonw.exe 5952 CreateFile C:\Program Files\Inkscape\share\extensions\lxml NAME NOT FOUND Desired Access: Read Attributes, Disposition: Open, Options:
20:38:47.3374175 pythonw.exe 5952 CreateFile C:\Program Files\Inkscape\share\extensions\lxml.pyd NAME NOT FOUND Desired Access: Generic Read, Disposition: Open,
20:38:47.3375415 pythonw.exe 5952 CreateFile C:\Program Files\Inkscape\share\extensions\lxml.py NAME NOT FOUND Desired Access: Generic Read, Disposition: Open,
20:38:47.3376596 pythonw.exe 5952 CreateFile C:\Program Files\Inkscape\share\extensions\lxml.pyw NAME NOT FOUND Desired Access: Generic Read, Disposition: Open,
20:38:47.3377762 pythonw.exe 5952 CreateFile C:\Program Files\Inkscape\share\extensions\lxml.pyc NAME NOT FOUND Desired Access: Generic Read, Disposition: Open,
20:38:47.3380155 pythonw.exe 5952 CreateFile C:\Program Files\Inkscape\python\lxml NAME NOT FOUND Desired Access: Read Attributes, Disposition: Open, Options:
20:38:47.3381360 pythonw.exe 5952 CreateFile C:\Program Files\Inkscape\python\lxml.pyd NAME NOT FOUND Desired Access: Generic Read, Disposition: Open, Options:
20:38:47.3382551 pythonw.exe 5952 CreateFile C:\Program Files\Inkscape\python\lxml.py NAME NOT FOUND Desired Access: Generic Read, Disposition: Open, Options:
20:38:47.3383697 pythonw.exe 5952 CreateFile C:\Program Files\Inkscape\python\lxml.pyw NAME NOT FOUND Desired Access: Generic Read, Disposition: Open, Options:
20:38:47.3384805 pythonw.exe 5952 CreateFile C:\Program Files\Inkscape\python\lxml.pyc NAME NOT FOUND Desired Access: Generic Read, Disposition: Open, Options:
20:38:47.3386633 pythonw.exe 5952 CreateFile C:\Program Files\Inkscape\python\Lib\lxml NAME NOT FOUND Desired Access: Read Attributes, Disposition: Open, Options:
20:38:47.3387734 pythonw.exe 5952 CreateFile C:\Program Files\Inkscape\python\Lib\lxml.pyd NAME NOT FOUND Desired Access: Generic Read, Disposition: Open, Options:
20:38:47.3388929 pythonw.exe 5952 CreateFile C:\Program Files\Inkscape\python\Lib\lxml.py NAME NOT FOUND Desired Access: Generic Read, Disposition: Open, Options:
20:38:47.3390078 pythonw.exe 5952 CreateFile C:\Program Files\Inkscape\python\Lib\lxml.pyw NAME NOT FOUND Desired Access: Generic Read, Disposition: Open, Options:
20:38:47.3391231 pythonw.exe 5952 CreateFile C:\Program Files\Inkscape\python\Lib\lxml.pyc NAME NOT FOUND Desired Access: Generic Read, Disposition: Open, Options:
20:38:47.3393125 pythonw.exe 5952 CreateFile C:\Program Files\Inkscape\lib\python2.7\lxml NAME NOT FOUND Desired Access: Read Attributes, Disposition: Open, Options:
20:38:47.3394160 pythonw.exe 5952 CreateFile C:\Program Files\Inkscape\lib\python2.7\lxml.pyd NAME NOT FOUND Desired Access: Generic Read, Disposition: Open, Options:
20:38:47.3395313 pythonw.exe 5952 CreateFile C:\Program Files\Inkscape\lib\python2.7\lxml.py NAME NOT FOUND Desired Access: Generic Read, Disposition: Open, Options:
20:38:47.3396497 pythonw.exe 5952 CreateFile C:\Program Files\Inkscape\lib\python2.7\lxml.pyw NAME NOT FOUND Desired Access: Generic Read, Disposition: Open, Options:
20:38:47.3397646 pythonw.exe 5952 CreateFile C:\Program Files\Inkscape\lib\python2.7\lxml.pyc NAME NOT FOUND Desired Access: Generic Read, Disposition: Open, Options:
20:38:47.3399450 pythonw.exe 5952 CreateFile C:\Program Files\Inkscape\lib\python2.7\plat-win32\lxml NAME NOT FOUND Desired Access: Read Attributes, Disposition: Open,
20:38:47.3400474 pythonw.exe 5952 CreateFile C:\Program Files\Inkscape\lib\python2.7\plat-win32\lxml.pyd NAME NOT FOUND Desired Access: Generic Read, Disposition: Open,
20:38:47.3401589 pythonw.exe 5952 CreateFile C:\Program Files\Inkscape\lib\python2.7\plat-win32\lxml.py NAME NOT FOUND Desired Access: Generic Read, Disposition: Open,
20:38:47.3403205 pythonw.exe 5952 CreateFile C:\Program Files\Inkscape\lib\python2.7\plat-win32\lxml.pyw NAME NOT FOUND Desired Access: Generic Read, Disposition: Open,
20:38:47.3404814 pythonw.exe 5952 CreateFile C:\Program Files\Inkscape\lib\python2.7\plat-win32\lxml.pyc NAME NOT FOUND Desired Access: Generic Read, Disposition: Open,
20:38:47.3407402 pythonw.exe 5952 CreateFile C:\Program Files\Inkscape\lib\python2.7\lib-tk\lxml NAME NOT FOUND Desired Access: Read Attributes, Disposition: Open, Options:
20:38:47.3408886 pythonw.exe 5952 CreateFile C:\Program Files\Inkscape\lib\python2.7\lib-tk\lxml.pyd NAME NOT FOUND Desired Access: Generic Read, Disposition: Open, Options:
20:38:47.3410338 pythonw.exe 5952 CreateFile C:\Program Files\Inkscape\lib\python2.7\lib-tk\lxml.py NAME NOT FOUND Desired Access: Generic Read, Disposition: Open, Options:
20:38:47.3411515 pythonw.exe 5952 CreateFile C:\Program Files\Inkscape\lib\python2.7\lib-tk\lxml.pyw NAME NOT FOUND Desired Access: Generic Read, Disposition: Open, Options:
20:38:47.3412616 pythonw.exe 5952 CreateFile C:\Program Files\Inkscape\lib\python2.7\lib-tk\lxml.pyc NAME NOT FOUND Desired Access: Generic Read, Disposition: Open, Options:
20:38:47.3414357 pythonw.exe 5952 CreateFile C:\Program Files\Inkscape\lib\python2.7\lib-dynload\lxml NAME NOT FOUND Desired Access: Read Attributes, Disposition: Open, Options:
20:38:47.3415663 pythonw.exe 5952 CreateFile C:\Program Files\Inkscape\lib\python2.7\lib-dynload\lxml.pyd NAME NOT FOUND Desired Access: Generic Read, Disposition: Open, Options:
20:38:47.3417189 pythonw.exe 5952 CreateFile C:\Program Files\Inkscape\lib\python2.7\lib-dynload\lxml.py NAME NOT FOUND Desired Access: Generic Read, Disposition: Open, Options:
20:38:47.3418833 pythonw.exe 5952 CreateFile C:\Program Files\Inkscape\lib\python2.7\lib-dynload\lxml.pyw NAME NOT FOUND Desired Access: Generic Read, Disposition: Open,
20:38:47.3420477 pythonw.exe 5952 CreateFile C:\Program Files\Inkscape\lib\python2.7\lib-dynload\lxml.pyc NAME NOT FOUND Desired Access: Generic Read, Disposition: Open,

Here is what is actually present in the Inkscape directory :

C:\Program Files\Inkscape>sfind . -name "lxml*"
.\lib\python2.7\site-packages\lxml
.\lib\python2.7\site-packages\lxml\includes\lxml-version.h
.\lib\python2.7\site-packages\lxml\lxml.etree.h
.\lib\python2.7\site-packages\lxml\lxml.etree_api.h
.\lib\python2.7\site-packages\lxml-4.1.0-py2.7.egg-info
.\python\Lib\site-packages\lxml

So as far as I can see, the installer is failing to install the correct files for the system to work as intended.

Cheers,
Hal

Revision history for this message
Halibut Hippo (halibuth) wrote :

OK, I have found a workaround to this problem.

If I copy the lxml directory from C:\Program Files\Inkscape\lib\python2.7\site-packages\lxml to a place that I know is being searched ( C:\Program Files\Inkscape\share\extensions\lxml ), the problem goes away.

Whether this ( failure to place the directory in one of the searched paths ) is the root cause of the problem is not clear. Another possibility is that the system path setting requires adjustment.

Revision history for this message
Halibut Hippo (halibuth) wrote :

site.py performs the following test in getsitepackages() :

       if sys.platform in ('os2emx', 'riscos'):
            sitepackages.append(os.path.join(prefix, "Lib", "site-packages"))
        elif _POSIX_BUILD:
            sitepackages.append(os.path.join(prefix, "lib",
                                        "python" + sys.version[:3],
                                        "site-packages"))
            sitepackages.append(os.path.join(prefix, "lib", "site-python"))
        else:
            sitepackages.append(prefix)
            sitepackages.append(os.path.join(prefix, "lib", "site-packages"))

If _POSIX_BUILD is defined, then site-packages would be correctly added to the known_paths list, and lxml could be located where it initially is in the installed system. However, this path is not actually searched, so the implication is that _POSIX_BUILD is not defined. The prefix path is searched, and the 'lib/site-packages' path is not searched - it does not exist and will not be added to known_paths, which is consistent with _POSIX_BUILD not being defined. This kind of makes sense for a Windows build, but I'm not a python expert.

So the root cause of this problem may be an assumption of POSIX behaviour. Unless one of the several other mechanisms for path adjustment is used to add 'site-packages', lxml will not be found. However, I'm a bit uncomfortable about this, because this theory would also mean that all the other packages in site-packages ( such as numpy ) were also inaccessible. Surely Inkscape - or some extensions - must use numpy somewhere ?

Revision history for this message
Jonathan Milton (jpmilton) wrote :

I'm having the same problem on Fedora 28 RPM inkscape-0.92.3-2.fc28.x86_64

If I create New from Template -> Icon, I get this in a pop up :

Traceback (most recent call last):
  File "/usr/share/inkscape/extensions/inkex.py", line 113, in <module>
    from lxml import etree
ModuleNotFoundError: No module named 'lxml'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "empty_icon.py", line 5, in <module>
    import inkex
  File "/usr/share/inkscape/extensions/inkex.py", line 119, in <module>
    "python-lxml\n\nTechnical details:\n%s" % (e, )))
  File "/usr/share/inkscape/extensions/inkex.py", line 101, in errormsg
    if isinstance(msg, unicode):
NameError: name 'unicode' is not defined

I have python2-lxml-4.1.1-2.fc28.x86_64 installed and if I fire up a python2 shell and call "from lmxl import etree" as per line 113, it works.

Revision history for this message
Abdelhak SAM (abdelhaksam) wrote :

Hi, i also just had the same problem with a fresh install of "Inkscape 0.92.2 2405546" (0.92.3 according to the package manager) on Antergos Linux (arch based).

Changed in inkscape:
status: New → Confirmed
Revision history for this message
Patrick Storz (ede123) wrote :

@halibuth - regarding the issue on Windows:
Please see the FAQ at [1] and see if it helps you solve the problem.

@jpmilton - regarding the issue on Fedora:
It seems the default "python" on your system is Python 3, which is not (yet) compatible with Inkscape and obviously will not be able to make use of python2-lxml. You can manually force the Python interpreter to "python2", see [2]. You might also consider letting packagers for Fedora know about this issue.

@abdelhaksam - regarding the issue on Antergos Linux:
Probably the same cause as on Fedora, so I suggest the same steps.

@all: For system-specific support requests like these it's usually better to ask on the inkscape-user mailing list or better yet to use the support channels fo your Linux distro. (Especially in cases like this, where similar issues can have very different causes that might not even be addressable by Inkscape developers themselves).

[1] https://inkscape.org/en/learn/faq/#fantastic-lxml-wrapper-libxml2-required-inkexpy-and-therefore-extension
[2] http://wiki.inkscape.org/wiki/index.php/Extension_Interpreters

Changed in inkscape:
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.