python-build-standalone: python-build-standalone ships sqlite3 module missing Connection.serialize, deserialize
I was really excited about switching away from poetry and pyenv to uv for building and testing our project.
However, our project relies on sqlite3.Connection.serialize and sqlite3.Connection.deserialize. The docs for these methods say:
Note This method is only available if the underlying SQLite library has the deserialize API.
My system Python (Python 3.12 on Ubuntu 24.04) and pyenv-supplied Python 3.11 (also on Ubuntu 24.04) have these methods. It seems like this is something that should normally be available.
I really hate having to switch back to pyenv because of this issue. Can you compile sqlite3 with the Connection.serialize and Connection.deserialize methods?
Steps to reproduce:
I tested with python-build-standalone cpython-3.11.11+20241206-x86_64-unknown-linux-gnu-install_only.tar.gz on Ubuntu 24.04.
Steps to reproduce with python-build-standalone Python 3.11.11:
Python 3.11.11 (main, Dec 6 2024, 20:02:44) [Clang 18.1.8 ] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> sqlite3.sqlite_version
'3.47.1'
>>> from sqlite3 import Connection
>>> Connection.serialize
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: type object 'sqlite3.Connection' has no attribute 'serialize'
Comparing with pyenv Python 3.11:
Python 3.11.9 (main, Aug 6 2024, 18:48:15) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> sqlite3.sqlite_version
'3.45.1'
>>> from sqlite3 import Connection
>>> Connection.serialize
<method 'serialize' of 'sqlite3.Connection' objects>
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 24 (16 by maintainers)
Commits related to this issue
- Configure `pkg-config` during CPython builds (#460) Closes https://github.com/astral-sh/python-build-standalone/issues/449 — committed to zanieb/python-build-standalone by zanieb 2 years ago
Thanks. I pulled the latest main branch of python-build-standalone, and built Python 3.11 on my Ubuntu 24.04 system using this command:
I extracted cpython-3.11.11-x86_64-unknown-linux-gnu-pgo-20250102T2257.tar.zst and ran python/install/bin/python and verified that the sqlite3 Connection.serialize and Connection.serialize methods now exist.
FWIW the linked CPython issue you filed makes sense to me: it seems there is a bug in CPython configure not handling static SQLite correctly. Not surprising since this won’t be a common configuration.
Agreed, I think this just has to be the responsibility of the person building downstream.
I am relatively new to this, but my understanding is that the
.pcfile should always place the statically linked libraries in theLibs.privatesection, what are you suggesting should change?Those missing math functions are found in libm. So linking against libm is necessary here.
I’m just surprised libm isn’t being linked with. Usually libc and libm are both linked in any non-trivial program.
I need to verify this, but I suspect the SQLite pkg-config incorrectly omits libm. Or maybe our static SQLite build confuses CPython configure. It’s got to be something specific to PBS because I refuse to believe this bug exists in CPython since people would have noticed.
Check how CPython sniffs the feature. They may not be doing it robustly.