Description: I use Python packages providing binary files in my extensions: - cffi - ijson - lxml To package these 3 python libraries in the extension I just need to put a copy of the library in the pythonpath folder of the extension with all the binary files for all the different architectures. It worked perfectly with LibreOffice 5.x, 6.x and 7.x on Windows and Linux, it works with LibreOffice 24.2.1.2 on Windows 10. With LibreOffice 24.2.x under Linux this no longer seems possible. Steps to Reproduce: 1.Try to install the OAuth2OOo extension [1] with 24.2.x on Linux 2.During installation an error occurs when importing the lxml module 3.Installation is interrupted Actual Results: Unable to install python packages with binaries under LibreOffice 24.2.x on Linux Expected Results: Be able to install python packages with binaries under LibreOffice 24.2.x on Linux Reproducible: Always User Profile Reset: No Additional Info: [1] https://prrvchr.github.io/OAuth2OOo/
How to reproduce without using the OAuth2OOo extension: The case where it works: - Install LibreOffice 24.2.x on Windows 10 64bits. - download and decompress the lxml package[1] for Windows amd64 / Python 3.8 into a directory. - Place the contents (ie: lxml-5.1.0.dist-info and lxml directory) of this archive in the LibreOffice Python lib directory (ie: C:\Program Files\LibreOffice\program\python-core-3.8.18\lib) - Open a terminal and place this in the folder: C:\Program Files\LibreOffice\program. - Load the Python console with the command: .\python - In the Python console import the lxml and etree modules using the commands: - import lxml - from lxml import etree - The 2 modules will be loaded correctly. The case where it doesn't work: - Install LibreOffice 24.2.x on Linux x86_64. - download and decompress the lxml package[2] for Linux x86_64 / Python 3.8 into a directory. - Place the contents (ie: lxml-5.1.0.dist-info and lxml directory) of this archive in the LibreOffice Python lib directory (ie: /opt/libreoffice24.2/program/python-core-3.8.18/lib) - Open a terminal and place this in the folder: /opt/libreoffice24.2/program. - Load the Python console with the command: ./python - In the Python console import the lxml and etree modules using the commands: - import lxml - from lxml import etree - When you import etree you will get the error: ImportError: cannot import name 'etree' from 'lxml' (/opt/libreoffice24.2/program/python-core-3.8.18/lib/lxml/__init__.py) [1] https://files.pythonhosted.org/packages/86/65/3d582b968b9b6c3efdc4e54f36878d0b79c51af10ec7c9d02d08dd72314b/lxml-5.1.0-cp38-cp38-win_amd64.whl [2] https://files.pythonhosted.org/packages/ee/08/8cb09c9a0d77e7b615ace332a76e6460f4c3b0a50654c181755c619c383e/lxml-5.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Last clarification: this is not necessarily linked to the python lxml package but to the fact that they have binary files since I have the same problem with the ijson, cffi and charser-normalizer packages.
I think this additional information will be enough to resolve this problem. - In LibreOffice 24.2.x python console for Windows 10, I get: >>> import distutils.sysconfig as ds >>> print(ds.get_config_var("EXT_SUFFIX")) .cp38-win_amd64.pyd - In LibreOffice 24.2.x python console for Linux, I get: >>> import distutils.sysconfig as ds >>> print(ds.get_config_var("EXT_SUFFIX")) .cpython-3.8.so It turns out that EXT_SUFFIX does not have the correct value which should be: .cpython-38-x86_64-linux-gnu.so Besides, if I rename the binary files under the wrong name I can import them...
I do not have the possibility to test under MacOS what about LibreOffice version 24.2. x under OSX?
cloph, could you please take a look?
Hi Pierre, Looking at the links you mentioned in 1, https://files.pythonhosted.org/packages/ee/08/8cb09c9a0d77e7b615ace332a76e6460f4c3b0a50654c181755c619c383e/lxml-5.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl wouldn't work even if EXT_SUFFIX were '.cpython-38-x86_64-linux-gnu' because the suffix of this file is '.manylinux2014_x86_64'. Are you sure it worked with LibreOffice prior to 7.6 ?
Hi Xisco, If you look in the file: https://files.pythonhosted.org/packages/ee/08/8cb09c9a0d77e7b615ace332a76e6460f4c3b0a50654c181755c619c383e/lxml-5.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl you will find: - lxml/_elementpath.cpython-38-x86_64-linux-gnu.so - lxml/builder.cpython-38-x86_64-linux-gnu.so - lxml/etree.cpython-38-x86_64-linux-gnu.so - lxml/objectify.cpython-38-x86_64-linux-gnu.so - lxml/sax.cpython-38-x86_64-linux-gnu.so - lxml/html/clean.cpython-38-x86_64-linux-gnu.so - lxml/html/diff.cpython-38-x86_64-linux-gnu.so all these files end with: .cpython-38-x86_64-linux-gnu.so
@Xisco > Are you sure it worked with LibreOffice prior to 7.6? Actually, I have never tested it and I fear it has never worked. So far, on Linux, I have only used LibreOffice publishing via Ubuntu packages and that does not package Python with LibreOffice.
Hi Pierre, Sorry for my previous comment, I was talking nonsense. The issue described here is the same as when installing numpy through pip, see https://bugs.documentfoundation.org/show_bug.cgi?id=143980#c15. For now, a workaround is to run for file in $(find instdir/program -name *.cpython-311-x86_64-linux-gnu.so); do cp "${file}" "${file/.cpython-311-x86_64-linux-gnu.so/.cpython-3.11.so}"; done
oh, interesting, LibreOffice compilation removes the suffix in external/python3/python-3.5.tweak.strip.soabi.patch
Xisco Fauli committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/3575986e30705d588d4eea94eb669474a3adbf77 tdf#162786, tdf#159988: python3: do not strip soabi on linux/macOS It will be available in 25.8.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Hi Cisco, > for file in $(find instdir/program -name *.cpython-311-x86_64-linux-gnu.so); do cp "${file}" "${file/.cpython-311-x86_64-linux-gnu.so/.cpython-3.11.so}"; done Since I noticed this issue, as a workaround, I make a link with the wrong file name (ie: *.cpython-3.8 and *.cpython-3.9). Did you manage to fix this problem and make EXT_SUFFIX return .cpython-38-x86_64-linux-gnu.so? The same problem, if it exists on the Apple Mac platforms, has it been resolved? I think that if we can answer these two questions then I will be able to close...
(In reply to prrvchr from comment #12) > Hi Cisco, > > > for file in $(find instdir/program -name *.cpython-311-x86_64-linux-gnu.so); do cp "${file}" "${file/.cpython-311-x86_64-linux-gnu.so/.cpython-3.11.so}"; done > > Since I noticed this issue, as a workaround, I make a link with the wrong > file name (ie: *.cpython-3.8 and *.cpython-3.9). > > Did you manage to fix this problem and make EXT_SUFFIX return > .cpython-38-x86_64-linux-gnu.so? > The same problem, if it exists on the Apple Mac platforms, has it been > resolved? > > I think that if we can answer these two questions then I will be able to > close... Hi Pierre, See comment 11. Yesterday I submitted a patch to master with the fix. it should be already available in daily builds and it should fix the problem on Linux and on Mac
@Xisco Ok, I will do the tests on the daily build and if someone can confirm that EXT_SUFFIX is correct on Apple Mac platform (I can't test) then I close. Thanks for this fix.
Hi, I made quick tests on Version: 25.8.0.0.alpha0+ (X86_64) / LibreOffice Community Build ID: b0a4afc58e1c9434e56ddb96c41f4ebe5985ed0a CPU threads: 4; OS: Linux 6.8; UI render: default; VCL: gtk3 Locale: fr-BE (fr_BE.UTF-8); UI: en-US Calc: threaded with the Apso package manager (https://gitlab.com/jmzambon/apso#package-manager-beta-feature), after disabling the current workaround. Everything seems to work fine. So thank you Xisco!
Verified based on comment 15.
Xisco Fauli committed a patch related to this issue. It has been pushed to "libreoffice-25-2": https://git.libreoffice.org/core/commit/e0c736642a34d10d899fc8a8a55ef2483b6b46d5 tdf#162786, tdf#159988: python3: do not strip soabi on linux/macOS It will be available in 25.2.1. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.