Bug 168512 - There is no sqlite3 module in embedded Python distribution
Summary: There is no sqlite3 module in embedded Python distribution
Status: ASSIGNED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
25.8.1.1 release
Hardware: x86-64 (AMD64) Windows (All)
: medium enhancement
Assignee: Xisco Faulí
URL:
Whiteboard:
Keywords:
: 163297 (view as bug list)
Depends on:
Blocks:
 
Reported: 2025-09-22 21:56 UTC by denis.gz
Modified: 2025-09-23 21:36 UTC (History)
2 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 denis.gz 2025-09-22 21:56:58 UTC
Description:
--

Steps to Reproduce:
1. Open console window
2. Create a working folder for a new project, change to that folder:
   mkdir proj && cd proj
3. Add (prepend) "C:\Program Files\LibreOffice\program" to the PATH:
   set PATH=C:\Program Files\LibreOffice\program;%PATH%
4. Verify the python.exe to be executed is the one from LibreOffice:
   where python
5. Provided that venv bug is resolved, or a workaround applied (see ticket
   #168215, create a virtual environment for the project:
   python -m venv venv
6. Activate virtual environment with command:
   venv\Scripts\activate
7. Test that "import sqlite3" works, or some package that depends on sqlite3
   could be installed (for example, pip install spyder)


Actual Results:
a) Import statement fails
b) Package cannot be installed

Expected Results:
a) Import statement fails
b) Package cannot be installed


Reproducible: Always


User Profile Reset: Yes

Additional Info:
There is no easy workaround for this issue. The standard sqlite3 module is implemented as a binary library (_sqlite3.pyd) and cannot be copied from another Python distribution, due to its dependency on Python3.dll. The latter one existed in LibreOffice is incompatible with the DLL existed in the official distribution.
Comment 1 denis.gz 2025-09-22 21:59:51 UTC
There is a typo in Expected results, please correct as following:

Expected Results:
a) Import statement succeeds
b) Package can be installed
Comment 2 denis.gz 2025-09-22 22:18:31 UTC
One more correction: if some package depends on sqlite3, there is usually no
explicit dependency which prevents installation (since the sqlite3 module is
included in standard distribution). However the installed module or application
would fail in runtime when import statement is encountered.
Comment 3 Xisco Faulí 2025-09-23 12:27:44 UTC
I gave a try in https://gerrit.libreoffice.org/c/core/+/191394 but it fails to build in Jenkins with 

The following modules are *disabled* in configure script:
_sqlite3                                                       

The necessary bits to build these optional modules were not found:
_curses               _curses_panel         _dbm               
_gdbm                 _tkinter              nis                
readline                                                       
To find the necessary bits, look in configure.ac and config.log.

Checked 111 modules (31 built-in, 71 shared, 1 n/a on linux-x86_64, 1 disabled, 7 missing, 0 failed on import)
make[2]: Leaving directory '/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/workdir/UnpackedTarball/python3'
Error: missing Modules/_sqlite3.cpython-312-x86_64-linux-gnu.so
make[1]: *** [/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/external/python3/ExternalProject_python3.mk:85: /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/workdir/ExternalProject/python3/build] Error 1
make[1]: *** Waiting for unfinished jobs....

because it depends on libsqlite3-dev
Comment 4 denis.gz 2025-09-23 13:24:37 UTC
The bug was reported for Windows actually. I'm using vcpkg and it builds like a charm. Though I'm sitting on an old branched repository (since I need to maintain a set of patches I made for the company I work for), I'm sure works out of the box perfectly as well.

Anyway, what's the problem with libsqlite3-dev?
Comment 5 Xisco Faulí 2025-09-23 13:53:22 UTC
(In reply to denis.gz from comment #4)
> The bug was reported for Windows actually. I'm using vcpkg and it builds
> like a charm. Though I'm sitting on an old branched repository (since I need
> to maintain a set of patches I made for the company I work for), I'm sure
> works out of the box perfectly as well.
> 
> Anyway, what's the problem with libsqlite3-dev?

if it's not installed, then it fails to build python3
Comment 6 denis.gz 2025-09-23 15:00:55 UTC
(In reply to Xisco Faulí from comment #5)
> if it's not installed, then it fails to build python3

Makes sense... Can't even suggest you anything.
Comment 7 Xisco Faulí 2025-09-23 15:07:13 UTC
(In reply to denis.gz from comment #6)
> (In reply to Xisco Faulí from comment #5)
> > if it's not installed, then it fails to build python3
> 
> Makes sense... Can't even suggest you anything.

we just need to install libsqlite3-dev in the Jenkins bots, unfortunately the sysadmin is on vacation so we will have to wait a bit...
Comment 8 Xisco Faulí 2025-09-23 15:22:34 UTC
*** Bug 163297 has been marked as a duplicate of this bug. ***
Comment 9 denis.gz 2025-09-23 15:43:29 UTC
(In reply to Xisco Faulí from comment #7)
> 
> we just need to install libsqlite3-dev in the Jenkins bots, unfortunately
> the sysadmin is on vacation so we will have to wait a bit...

Ah, it's ok then) Anyway, these bugs are no show-stoppers for me. I've opened them for other developers to have an easier time setting everything up, and thus, to make Python development for LO more popular.

By the way, Spyder developers have announced a fix in 6.1.0 which would let inspecting internal scriptforge structures in the Variable Explorer: https://github.com/spyder-ide/spyder/issues/24324.

So the things going to be even better)


(In reply to Xisco Faulí from comment #8)
> *** Bug 163297 has been marked as a duplicate of this bug. ***

Using pysqlite3 could be a solution, provided that it's renamed as sqlite3. However, IIRC if there's no "wheel" for this package, it's quite difficult for a Python developer to have it installed.
Comment 10 nobu 2025-09-23 21:36:45 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