question about pkg default compilation options for python

hello,
i'm using qgis on a freebsd release 14.3 and one of the plugins cannot work because it cannot create a sqlite-db.
i noticed that the extension _sqlite3 is disabled by default in the makefile and as far as i understand this is how the official pkg is created.
is there a reason (security?) that this is the case?

in any case, short of compiling from the ports, do i have a solution for that? this would undoubtedly be costly to recompile via poudriere on a "normal" laptop, wouldn't it?

anyways, thanks for the work in maintaining the port to those who do!
all the best,
a-

ps: i send this as an email but was asked to join the mailing list, it seems overkill to me and decided to post it here, if i broke many convention by doing it i apologize and will make penance by going in the forest and stroll under the rain for a while. if i *again* posted in the wrong topic, i'll do likewise. thanks :)
 
What does prevent you from installing the sqlite3 extension?
pkg install py311-sqlite3
when i read that i almost facepalmed myself... but actually this is not the issue :) for a moment i thought i was really silly. sqlite3 module is installed on my machine (i use it in other programs).
however, here is the error i got from qgis when attempting to use the plugin i need:

Code:
search_dialog.py", line 370, in checkMajicContent
              connector = CadastreCommon.getConnectorFromUri(self.connectionParams)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
              File "/home/hern42/.local/share/QGIS/QGIS3/profiles/default/python/plugins/cadastre/cadastre_common_base.py", line 234, in getConnectorFromUri
              connector = SpatiaLiteDBConnector(uri)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^
              File "/usr/local/share/qgis/python/plugins/db_manager/db_plugins/spatialite/connector.py", line 52, in __init__
              self.connection = spatialite_connect(self._connectionInfo())
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
              File "/usr/local/share/qgis/python/qgis/utils.py", line 940, in spatialite_connect
              con.enable_load_extension(True)
              ^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'sqlite3.Connection' object has no attribute 'enable_load_extension'

when looking at the makefile of /ports/lang/python311 there is the following line: DISABLED_EXTENSIONS= _sqlite3 _tkinter _gdbm which lets me think that i'd need to use a version of python311 with _sqlite3 not in the list of disabled extensions.
am i correct?
 
when looking at the makefile of /ports/lang/python311 there is the following line: DISABLED_EXTENSIONS= _sqlite3 _tkinter _gdbm which lets me think that i'd need to use a version of python311 with _sqlite3 not in the list of disabled extensions.
It may be disabled in python311 for the same reason it is disabled in python314:

Commit "lang/python314: split out _sqlite3 again."
Rich (BB code):
to avoid a dependency loop through ICU.

You can still try to compile from the ports tree (not poudriere) with the flag removed from the Makefile. To prevent building dependency ports use packages instead ("install-missing-packages"). There are quite a lot dependencies to build:
Code:
ports/lang/python311 ~ % make all-depends-list | wc -l
     908
The packages list should be shorter.
 
You can still try to compile from the ports tree (not poudriere) with the flag removed from the Makefile. To prevent building dependency ports use packages instead ("install-missing-packages"). There are quite a lot dependencies to build:
Code:
ports/graphics/qgis ~ % make all-depends-list | wc -l
    1270
The packages list should be shorter.
thanks for the answer...
will it not conflict with the pkg or should i delete it before?
 
will it not conflict with the pkg or should i delete it before?
Yes, it will conflict, but there is code to prevent the installation in this case and the user will be notified. But you don't need to de-install first, the "reinstall" target takes care of de-installation of the old package and installation of the new one ( ports(7) ).

But lets see if you get that far. There must be a reason the flag was set.

After you are done testing, you can remove the installed build dependencies executing pkg-autoremove(8).
 
Yes, it will conflict, but there is code to prevent the installation in this case and the user will be notified. But you don't need to de-install first, the "reinstall" target takes care of de-installation of the old package and installation of the new one ( ports(7) ).

But lets see if you get that far. There must be a reason the flag was set.

After you are done testing, you can remove the installed build dependencies executing pkg-autoremove(8).

some feedback about this affair :)

so i did that... recompile python with the flag set off.
i worked fine and was not really long.
then i reinstalled py-sqlite3
and it did not solve the issue with said qgis plugin...
i still need to see if installing py-sqlite-utils will change anything. then i'll email the plugin author and investigate that trail.

i'll keep you posted!
 
Code:
% sqlite3
SQLite version 3.50.4 2025-07-30 19:33:53
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> .dbconfig
...
     load_extension on
...
sqlite> .quit


pkg info sqlite3



python3.11
Python 3.11.14 (main, Nov 14 2025, 07:59:58) [Clang 19.1.7 (https://github.com/llvm/llvm-project.git llvmorg-19.1.7-0-gcd7080 on freebsd14
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> conn = sqlite3.connect(":memory:")
>>> conn.execute("create table users(id, name)")
<sqlite3.Cursor object at 0x330877e3f2c0>
>>> conn.close()
>>> quit()
 
Code:
% sqlite3
SQLite version 3.50.4 2025-07-30 19:33:53
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> .dbconfig
...
     load_extension on
...
sqlite> .quit


pkg info sqlite3


i have exactly the same output as you...
so that means the plugin is buggy? this one -> https://docs.3liz.org/QgisCadastrePlugin/ or https://github.com/3liz/QgisCadastrePlugin
 
I don't know which version of qgis you have in "/home/hern42/.local/share/QGIS/QGIS3/" You can try the 3.44.4 version from the ports /usr/ports/graphics/qgis

qgis->Plugins -> Manage and install Plugins... -> install from ZIP

1763474802801.png
 
I don't know which version of qgis you have in "/home/hern42/.local/share/QGIS/QGIS3/" You can try the 3.44.4 version from the ports /usr/ports/graphics/qgis


qgis->Plugins -> Manage and install Plugins... -> install from ZIP
the bug happens when trying to create a new spatialite database. cf screenshot. it creates a file but it's empty.
my qgis version is 3.44.4 and the plugin is 2.2.3
 

Attachments

  • 20251118_1922-screenshot_000.jpg
    20251118_1922-screenshot_000.jpg
    231.3 KB · Views: 12
Try to build python311 from the ports and add --enable-loadable-sqlite-extensions in configure_args in makefile

Code:
DISABLED_EXTENSIONS=    _tkinter _gdbm
CONFIGURE_ARGS+=        --enable-loadable-sqlite-extensions --enable-shared --without-ensurepip \
                        --with-system-ffi

1763535762001.png

1763536642761.png
 
Back
Top