Bug 163297 - Embed python in LibreOffice 24.8.2.1 can not import sqlite3
Summary: Embed python in LibreOffice 24.8.2.1 can not import sqlite3
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Extensions (show other bugs)
Version:
(earliest affected)
24.8.2.1 release
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Macro-Python
  Show dependency treegraph
 
Reported: 2024-10-04 11:52 UTC by PHAM XUAN TIEN
Modified: 2025-02-13 00:44 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description PHAM XUAN TIEN 2024-10-04 11:52:04 UTC
Description:
Embed python in LibreOffice 24.8.2.1 can not import sqlite3

I fix by replace C:\Program Files\LibreOffice\program\sqlite3.dll with new one copy from native python3.9.13

Steps to Reproduce:
1.Open APSO
2.import sqlite3

Actual Results:
Raise an error

Expected Results:
No error


Reproducible: Always


User Profile Reset: Yes

Additional Info:
I fix by replace C:\Program Files\LibreOffice\program\sqlite3.dll with new one copy from native python3.9.13
Comment 1 Xisco Faulí 2024-10-04 12:16:39 UTC
Yes, it's not supported, See the comment in https://opengrok.libreoffice.org/xref/core/external/python3/ExternalPackage_python3.mk?r=a3adfdb2
Comment 2 Hossein 2024-10-04 12:45:41 UTC
Hello Xisco,
With the latest LO 25.2 dev master, I get:

$ instdir/program/python
Python 3.10.15 (main, Sep 24 2024, 13:53:16) [GCC 12.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite
Fatal Python error: _PyMem_DebugMalloc: Python memory allocator called without holding the GIL
Python runtime state: initialized

Current thread 0x00007f67115f8b80 (most recent call first):
  <no Python frame>
Aborted (core dumped)

Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: bb0e5aa97965b2710200da677db032289c373afe
CPU threads: 12; OS: Linux 6.2; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: CL threaded

Is this a separate issue?


There is another bug report for shipping PIP:
tdf#162786 - Ship Python package manager (PIP) with LibreOffice internal Python
https://bugs.documentfoundation.org/show_bug.cgi?id=162786
Comment 3 nobu 2024-10-24 07:32:03 UTC
OS: Windows 10
Only Version 24.8 failed to import in my environment.
No errors in other versions.
That's very strange.

Isn't the "sqlite3.dll" that comes with Version 24.8 (Python3.9) the wrong file for Version 25.2 (Python3.10)?
It is a miracle that the file size of "sqlite3.dll" is the same in Python 3.9 and 3.10.
But I'm not an expert and I don't know how to prove it.
It's just a hypothesis.

(Translated by Textra)
Comment 4 nobu 2024-10-31 07:17:12 UTC
It worked in the following environments.
OS:Windows 10
LibreOffice_24.8.3.1_Win_x86-64.msi
Comment 5 nobu 2024-10-31 21:28:06 UTC
I copied "sqlite3.dll" installed by "LibreOfficePortable_24.8.2_MultilingualStandard.paf.exe".
Comment 6 Xisco Faulí 2025-02-13 00:44:09 UTC
After bug 162786 has been fixed, you can do instdir/program/python -m pip install pysqlite3 --user to install it and use "import pysqlite3"
I think this can be closed as RESOLVED FIXED