File "/usr/lib64/calibre/calibre/constants.py", line 325, in load_apsw_extension conn.enableloadextension(True) AttributeError: 'Connection' object has no attribute 'enableloadextension' Calibre works with dev-python/apsw-3.38.1_p1. Recompiling calibre after dev-python/apsw-3.38.5_p1 does not help. Reproducible: Always
According to https://bugs.launchpad.net/calibre/+bug/1935747, "sqlite extension loading" need to be enabled. Comparing good and bad ebuild: --- dev-python/apsw/apsw-3.38.1_p1.ebuild 2022-06-01 11:51:42.989165532 +0200 +++ dev-python/apsw/apsw-3.38.5_p1.ebuild 2022-06-10 15:28:53.683234235 +0200 @@ -4,7 +4,7 @@ EAPI=8 DISTUTILS_USE_PEP517=setuptools -PYTHON_COMPAT=( python3_{8..10} ) +PYTHON_COMPAT=( python3_{8..11} ) inherit distutils-r1 @@ -24,7 +24,7 @@ LICENSE="ZLIB" SLOT="0" -KEYWORDS="amd64 ~arm ~ppc64 x86" +KEYWORDS="~amd64 ~arm ~ppc64 ~x86" IUSE="doc" DEPEND=" @@ -38,12 +38,6 @@ "${FILESDIR}/${PN}-3.6.20.1-fix_tests.patch" ) -python_compile() { - distutils-r1_python_compile --enable=load_extension - mv "${BUILD_DIR}/install${EPREFIX}/usr/apsw.pyi" \ - "${BUILD_DIR}/install$(python_get_sitedir)" || die -} - python_test() { esetup.py build_test_extension "${EPYTHON}" tests.py -v || die "Tests failed under ${EPYTHON}"
I have same error using stable dev-python/apsw-3.38.1_p1
Created attachment 786389 [details, diff] Ebuild patch to restore --enable=load_extension This restores the --enable=load_extension part and calibre opens properly from quick test
I patched apsw-3.38.5_p1 and installed it. Still not working.(As I said it did not work with apsw-3.38.1_p1 too).
(In reply to krloom from comment #4) > I patched apsw-3.38.5_p1 and installed it. > Still not working.(As I said it did not work with apsw-3.38.1_p1 too). I would expect the patched version to work. Are you sure you installed the right one? You'll need to patch the ebuild itself.
On my side, downgrade worked, and patch works for me. Thank’s!
Hi! (In reply to Sam James from comment #5) > (In reply to krloom from comment #4) > > I patched apsw-3.38.5_p1 and installed it. > > Still not working.(As I said it did not work with apsw-3.38.1_p1 too). > > I would expect the patched version to work. Are you sure you installed the > right one? You'll need to patch the ebuild itself. Yeah, I installed right one. (I used commands like "ebuild apsw-3.38.5_p1.ebuild digest" and "ACCEPT_KEYWORDS="~amd64" emerge apsw -v" ) But one more thing: my environment is PYTHON_SINGLE_TARGET="python3_10" PYTHON_TARGETS="python3_10" so maybe I have some kind of python-10 problem. As I already said stable apsw is broken too.
The patched ebuild fixes the problem for me too, thanks!
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=da975336a864f624adb8931df83fdf0a4e64bd1c commit da975336a864f624adb8931df83fdf0a4e64bd1c Author: Sam James <sam@gentoo.org> AuthorDate: 2022-06-23 05:41:38 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2022-06-23 05:41:38 +0000 dev-python/apsw: restore extension to fix Calibre Closes: https://bugs.gentoo.org/851741 Signed-off-by: Sam James <sam@gentoo.org> dev-python/apsw/apsw-3.38.5_p1-r1.ebuild | 54 ++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+)
*** Bug 859892 has been marked as a duplicate of this bug. ***
Hello, I tried to solve this problem by syncing and updating world, but I still have the same problem, even when I upgraded apsw to version 3.38.5_p1-r1: $ ipython Python 3.10.5 (main, Jul 22 2022, 11:55:31) [GCC 11.3.0] Type 'copyright', 'credits' or 'license' for more information IPython 8.4.0 -- An enhanced Interactive Python. Type '?' for help. In [1]: import apsw In [2]: connection=apsw.Connection(":memory:") In [3]: connection.enableloadextension(True) --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Input In [3], in <cell line: 1>() ----> 1 connection.enableloadextension(True) AttributeError: 'apsw.Connection' object has no attribute 'enableloadextension' In [4]: apsw.apswversion() Out[4]: '3.38.5-r1'
(In reply to David Suarez from comment #11) > Hello, I tried to solve this problem by syncing and updating world, but I > still have the same problem, even when I upgraded apsw to version > 3.38.5_p1-r1: > > $ ipython >[...] > AttributeError: 'apsw.Connection' object has no attribute > 'enableloadextension' > > In [4]: apsw.apswversion() > Out[4]: '3.38.5-r1' Thanks for sharing a reproducer. $ python3.10 >>> import apsw >>> connection=apsw.Connection(":memory:") >>> connection.enableloadextension(True) >>> apsw.apswversion() '3.38.5-r1' This works okay for me. Could you share: 1. emerge --info dev-python/apsw 2. equery f dev-python/apsw (use an attachment for that)?
Created attachment 793238 [details] Output of emerge --info dev-python/apsw
Created attachment 793241 [details] Output of equery f dev-python/apsw
(In reply to David Suarez from comment #14) > Created attachment 793241 [details] > Output of equery f dev-python/apsw Huh. Our lists are the same and the extension is installed... (/usr/lib/python3.10/site-packages/apsw/__init__.cpython-310-x86_64-linux-gnu.so).
(In reply to Sam James from comment #15) > (In reply to David Suarez from comment #14) > > Created attachment 793241 [details] > > Output of equery f dev-python/apsw > > Huh. Our lists are the same and the extension is installed... > (/usr/lib/python3.10/site-packages/apsw/__init__.cpython-310-x86_64-linux- > gnu.so). Yes, I don't know what is wrong, but I am afraid it is related to how apsw is built by portage, since when I build it from source it doesn't throw the error: (apsw)$ python Python 3.10.5 (main, Jul 22 2022, 11:55:31) [GCC 11.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import apsw >>> apsw.apswversion() '3.38.5-r1' >>> apsw.__file__ '/tmp/apsw/lib/python3.10/site-packages/apsw-3.38.5.post1-py3.10-linux-x86_64.egg/apsw/__init__.cpython-310-x86_64-linux-gnu.so' >>> connection=apsw.Connection(":memory:") >>> connection.enableloadextension(True) While the system version does: $ python Python 3.10.5 (main, Jul 22 2022, 11:55:31) [GCC 11.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import apsw >>> apsw.apswversion() '3.38.5-r1' >>> apsw.__file__ '/usr/lib/python3.10/site-packages/apsw/__init__.cpython-310-x86_64-linux-gnu.so' >>> connection=apsw.Connection(":memory:") >>> connection.enableloadextension(True) Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'apsw.Connection' object has no attribute 'enableloadextension'
I used following dirty hack to get dev-python/apsw-3.39.2.0::gentoo working: 1. # FEATURES="keepwork" emerge apsw -v 2. Calibre does not work 3. Edit file /tmp/portage/dev-python/apsw-3.39.2.0/work/apsw-3.39.2.0/src/connection.c remove line "#if !defined(SQLITE_OMIT_LOAD_EXTENSION)" and "#endif" in lines 3668 and 3673 4. rm /tmp/portage/dev-python/apsw-3.39.2.0/.compiled 5. # FEATURES="keepwork" emerge apsw -v 6. Calibre is ok :)
Created attachment 803356 [details, diff] apsw-3.39.2.1-enable-more-extensions.patch Could someone try apsw-3.39.2.1-enable-more-extensions.patch I've attached? I still have no idea why I can't repro this. I'm wondering if there's some orphaned file on your system? Could someone still hitting this run: qfile -o /usr/lib/python3.*/*/*
(In reply to Sam James from comment #18) > Created attachment 803356 [details, diff] [details, diff] > apsw-3.39.2.1-enable-more-extensions.patch > > Could someone try apsw-3.39.2.1-enable-more-extensions.patch I've attached? > > I still have no idea why I can't repro this. > > I'm wondering if there's some orphaned file on your system? > > Could someone still hitting this run: qfile -o /usr/lib/python3.*/*/* FYI, upstream is working on making apsw autodetect build options from sqlite3, and it'll probably be in the next release.
It seems dev-python/apsw-3.39.2.1 breaks this again. It seems handling multiple --enable= arguments is not supported in the way the ebuild tries it. So this change is needed: --- a/dev-python/apsw/apsw-3.39.2.1.ebuild +++ b/dev-python/apsw/apsw-3.39.2.1.ebuild @@ -33,7 +33,7 @@ RDEPEND=" python_compile() { # Needed for e.g. bug #851741 # Enable column-metadata to match dev-db/sqlite - distutils-r1_python_compile --enable=load_extension --enable=column_metadata + distutils-r1_python_compile --enable=load_extension,column_metadata } python_test() {
Hi! I patched both apsw-3.39.2.0.ebuild and apsw-3.39.2.1.ebuild with "distutils-r1_python_compile --enable=load_extension,column_metadata" line. But Calibre did not work with that. I got Calibre again working with " krloom@gmail.com 2022-09-04 09:58:23 UTC " hack. I think maybe bug is here (from emerge -v output): x86_64-pc-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -march=native -O2 -pipe -flto=3 -fuse-linker-plugin -fPIC -DNDEBUG=1 -DAPSW_FORK_CHECKER=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -Isrc -I/usr/include/python3.10 -c src/apsw.c -o build/temp.linux-x86_64-cpython-310/src/apsw.o Look at this "-DSQLITE_OMIT_LOAD_EXTENSION=1" compiler switch. I do not know where it comes.....
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6f184c3a08706e44f848ef7428adf3315a4e2999 commit 6f184c3a08706e44f848ef7428adf3315a4e2999 Author: Sam James <sam@gentoo.org> AuthorDate: 2022-09-06 21:54:45 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2022-09-06 21:54:45 +0000 dev-python/apsw: fix --enable for extensions syntax Needs to be comma separated. Not adding the whole list right now as upstream are working on autodetection? Bug: https://bugs.gentoo.org/851741 Signed-off-by: Sam James <sam@gentoo.org> dev-python/apsw/{apsw-3.39.2.1.ebuild => apsw-3.39.2.1-r1.ebuild} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Really sorry to say that dev-python/apsw-3.39.3.0 got me the same calibre error again: calibre, version 5.44.0 [Invalid database location...] Traceback (most recent call last): File "/usr/lib64/calibre/calibre/gui2/main.py", line 330, in initialize_db db = LibraryDatabase(self.library_path) File "/usr/lib64/calibre/calibre/db/legacy.py", line 187, in __init__ backend = self.backend = create_backend(library_path, default_prefs=default_prefs, File "/usr/lib64/calibre/calibre/db/legacy.py", line 44, in create_backend return DB(library_path, default_prefs=default_prefs, File "/usr/lib64/calibre/calibre/db/backend.py", line 460, in __init__ if self.user_version == 0: File "/usr/lib64/calibre/calibre/db/backend.py", line 1212, in user_version return self.conn.get('pragma user_version;', all=False) File "/usr/lib64/calibre/calibre/db/backend.py", line 925, in conn self._conn = Connection(self.dbpath) File "/usr/lib64/calibre/calibre/db/backend.py", line 339, in __init__ plugins.load_apsw_extension(self, 'sqlite_extension') File "/usr/lib64/calibre/calibre/constants.py", line 329, in load_apsw_extension conn.enableloadextension(True) AttributeError: 'Connection' object has no attribute 'enableloadextension' Now, I guess this version of dev-python/apsw should have the autodetection discussed in https://github.com/rogerbinns/apsw/issues/363 ? There no longer are --enable options at all to tinker with, only use_system_sqlite_config=True... Again, recompiling calibre, or recompiling apsw without ccache etc, did not help. Using dev-python/apsw-3.39.2.1-r1 did. BTW: qfile -o /usr/lib/python3.*/*/* for me gives: /usr/lib/python3.10/site-packages/include_server-3.4-py3.10.egg-info.backup.0000 /usr/lib/python3.10/site-packages/tre-0.8.0-py3.10.egg-info.backup.0000
I'm sorry about that. I guess load_extension is not something that is enabled through autodetection -- I guess it's special.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cb01a1c377bb2bf0ffec4bc8f47da12f61f23cbb commit cb01a1c377bb2bf0ffec4bc8f47da12f61f23cbb Author: Michał Górny <mgorny@gentoo.org> AuthorDate: 2022-09-24 19:36:27 +0000 Commit: Michał Górny <mgorny@gentoo.org> CommitDate: 2022-09-24 19:38:00 +0000 dev-python/apsw: Reenable load_extension, again Closes: https://bugs.gentoo.org/851741 Signed-off-by: Michał Górny <mgorny@gentoo.org> dev-python/apsw/{apsw-3.39.3.0.ebuild => apsw-3.39.3.0-r1.ebuild} | 1 + 1 file changed, 1 insertion(+)
Thanks Michał - that worked :-)