ImportError: No module named '_sqlite3'

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ImportError: No module named '_sqlite3'

4,813 Views
benjamin_levy
Contributor I

Setting up Yocto on my Ubuntu (Ubuntu 18.04.3 LTS/bionic) system, the command:  

~/poky/build$ bitbake core-image-sato

Results in this error:

File "/usr/local/lib/python3.5/sqlite3/dbapi2.py", line 27, in <module>

from _sqlite3 import *
ImportError: No module named '_sqlite3'

Below is my effort to proceed past this error, which didn't resolve the error above.  Please be generous and provide some guidance.  I searched for relevant posting locations; any advice on a better place is appreciated.  Thank you.

------------------------------------------------

A web search on this error () results in:

How to Use SQLite in Ubuntu | Chron.com 

with

~/poky/build$ sudo apt-get install sqlite3 libsqlite3-dev

which tells me this:

Reading package lists... Done
Building dependency tree
Reading state information... Done
libsqlite3-dev is already the newest version (3.22.0-1ubuntu0.1).
sqlite3 is already the newest version (3.22.0-1ubuntu0.1).
The following packages were automatically installed and are no longer required:
linux-headers-5.0.0-23 linux-headers-5.0.0-23-generic linux-image-5.0.0-23-generic linux-modules-5.0.0-23-generic
linux-modules-extra-5.0.0-23-generic
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 12 not upgraded.

So, evidently sqlite3 exists on my system.

0 Kudos
2 Replies

3,997 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello Benjamin,

You need python 3.6 to install sqlite3, in yocto you have python 3.4.

Regards

0 Kudos

3,997 Views
benjamin_levy
Contributor I

I have Python3.6 installed in /usr/bin/ as...

lrwxrwxrwx 1 root root 9 Oct 7 05:43 python3 -> python3.6

-rwxr-xr-x 2 root root 4526456 Oct 7 08:59 python3.6

Python3.6 is required for Ubuntu 18.04 (my version), as I read.

Using which python3 points to the 3.5 version in /usr/local/bin/ as...

lrwxrwxrwx 1 root root 9 Oct 7 14:27 python3 -> python3.5

-rwxr-xr-x 2 root root 13280072 Oct 7 14:27 python3.5

It is clear that the symbolic link to 3.5 in /usr/local/bin/ supersedes the symbolic link to 3.6 in /usr/bin/

Not being much of a Ubuntu user (yet), I don't know what to do. Remove the link to 3.5?

Thank you.

BSL

0 Kudos