Sqlite3 module for python3 not being found - duo 64m

Sqlite3 working but using it in python: import sqlite3 says “ModuleNotFoundError: No module named ‘sqlite3’”

sqlite3 is supposed to be welded into python so it is significant loss if its not working. Using latest git clone. Enabled python-sqlite module in menuconfig. That compiled OK but python does not recognise “import sqlite3”.

Any thoughts?

I doubt that.

buildroot-2021.05/package/python/python.mk:     --disable-sqlite3 \
buildroot-2021.05/package/python/python.mk:PYTHON_CONF_OPTS += --disable-sqlite3

But I think you can enable the modules you like.

I don’t understand fine details beyond this point. I commented out that line and a further line about SQL I modified:

ifeq ($(BR2_PACKAGE_PYTHON3_SQLITE),y)
PYTHON3_DEPENDENCIES += sqlite
else
####### PYTHON3_CONF_OPTS += --disable-sqlite3 ######
PYTHON3_DEPENDENCIES += sqlite
endif

Still no result for import sqlite3.

And there can be other places where it has been disabled as well. I wish I could give you the solution right away, but it seems it will take more time. );

1 Like

Thanks for looking into it.

Interestingly the Ubuntu distro here Third-party Image and SDK | Milk-V
has python3 sqlite3 working:

import pkgutil

# List all available modules
module_names = sorted([module.name for module in pkgutil.iter_modules()])
for name in module_names:
    print(name)

But it was not compiled for the arduino branch - so may be try the instructions there for creating an image after switching to arduino branch and also if viable check what the differences are that made it work.

1 Like

You can export these commits as patches and adapt paths to the files accordingly, so that you can apply them onto your own subbranch of that Ubuntu repo.

1 Like

Probably Ubuntu is a dead end. Seems the rootfs made by buildroot is being replaced by ubuntu in its entirety. I can’t see how ubuntu knows which hardware board its running on. Back to try repair arduino branch for python sqlite3.

2 Likes

I’m not sure if this is correct, but do you need to add a line to the milkv_duo_musl_riscv64_defconfig file?

milkv_duo_musl_riscv64_defconfig:

BR2_PACKAGE_PYTHON3_SQLITE=y

1 Like

No luck.

Tried BR2_PACKAGE_PYTHON3_SQLITE3=y as well, no luck.

1 Like

I tried enabling micropython as an alternative. It seems to compile without errors. When I run micropython it says micropython: not found. If I go to /usr/bin, microphthon is there:

[root@milkv-duo]/usr/bin# ls -l micropython
-rwxr-xr-x 1 dhcpcd dhcpcd 605576 Jul 21  2024 micropython

If I try to run it directly with ./micropython still says micropython not found.
Not sure what gives here.

[I enabled the nano editor in same way, and it got compiled and put into usr/bin OK - so the make menuconfig and make savedefconfig work OK.]

1 Like