0

my first posting on setting up Yocto development environment on my Ubuntu system (Ubuntu 18.04.3 LTS/bionic), based on the information enclosed in the document from this web link (https://www.yoctoproject.org/docs/current/brief-yoctoprojectqs/brief-yoctoprojectqs.html).

All is well until... ~/poky/build$ bitbake core-image-sato

which 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.  Here are the SO references that I checked:

[ImportError: No module named '_sqlite3' in python3.3][1]
[importerror no module named '_sqlite3' python3.4][2]
[ImportError: No module named _sqlite3 (even after doing eveything)][3]
[ImportError: No module named _sqlite3][4]


[1]: https://stackoverflow.com/questions/20126475/importerror-no-module-named-sqlite3-in-python3-3
[2]: https://stackoverflow.com/questions/24052137/importerror-no-module-named-sqlite3-python3-4
[3]: https://stackoverflow.com/questions/35889383/importerror-no-module-named-sqlite3-even-after-doing-eveything
[4]: https://stackoverflow.com/questions/2665337/importerror-no-module-named-sqlite3
Benjamin Levy
  • 333
  • 6
  • 19
  • According to the NXP semiconductor people, Ubuntu_18.04 needs Python3.6; then I can install install sqlite3. My system has Python3.5 and Python3.6 installed, in different directories; probably what's confusing bitbake/Yocto. Inspecting my Ubuntu_18.04 system, I find...Python3.6 installed in /usr/bin/ as... lrwxrwxrwx python3 -> python3.6 -rwxr-xr-x python3.6 WHICH python3 points to the 3.5 version in /usr/local/bin/ as... lrwxrwxrwx python3 -> python3.5 -rwxr-xr-x python3.5 The symbolic link to 3.5 in /usr/local/bin/ supersedes symbolic link to 3.6 in /usr/bin/. Remove link to 3.5? – Benjamin Levy Oct 23 '19 at 20:12

1 Answers1

0

I have just kicked off a build verifying the Brief-Quickstart steps verbatim on an otherwise fresh Ubuntu 18.04 install. There is not even SQLite installed at all, yet the build proceeds nicely. So the chances are pretty high the python installation in your development host is busted in some way or the other. Yet, there might be reasons for it:

  • you maybe selected python 3.5 explicitly because some other thing you did requires it
  • you maybe selected python 3.5 implicitly because you forwarded from on old installation, installed something that depended on it, or similar.

In any case, I'd guess that now tinkering with the link might break things somewhere else on your machine, which should be avoided IMHO.

So what are your options now? My advice would be to start building in a container, in the simplest for that requires no more than installing docker and kicking off docker run -it ubuntu:bionic /bin/bash - at least to verify things are generally working.

In the longer term you might want to make a specialized container for this with one or two additions:

1) have all the needed packages set up already 2) using a standard user instead of root.

This is the way I do things personally. An alternative would be to use the prepared things by CROPS as it is a known good solution, and it significantly reduces problems originating from host system pecularities.

LetoThe2nd
  • 1,161
  • 7
  • 13
  • Installed python3.5 myself because I try to stay one version behind until the newest version is broadly and safely used. I'm only using 3.5 for Spyder. It's a brand-new Ubuntu installation, other than that. I'll try your 'docker' suggestion; still, I'm not that far down the road that I can't restart again if I remove the Python3.5 symbolic link. – Benjamin Levy Oct 24 '19 at 11:11