0

I met a strange problem when using Ubuntu 20.04 LTS. When I type any non-meaning word in the command line, such as a letter A, it returns something related to python3.8 with "ImportError: /usr/lib/python3.8/lib-dynload/_sqlite3.cpython-38-x86_64-linux-gnu.so: undefined symbol: sqlite3_errstr". Please see below,

huan@grape:~$ A
Traceback (most recent call last):
  File "/usr/lib/command-not-found", line 28, in <module>
    from CommandNotFound import CommandNotFound
  File "/usr/lib/python3/dist-packages/CommandNotFound/CommandNotFound.py", line 19, in <module>
    from CommandNotFound.db.db import SqliteDatabase
  File "/usr/lib/python3/dist-packages/CommandNotFound/db/db.py", line 3, in <module>
    import sqlite3
  File "/usr/lib/python3.8/sqlite3/__init__.py", line 23, in <module>
    from sqlite3.dbapi2 import *
  File "/usr/lib/python3.8/sqlite3/dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ImportError: /usr/lib/python3.8/lib-dynload/_sqlite3.cpython-38-x86_64-linux-gnu.so: undefined symbol: sqlite3_errstr

I have searched online, but I could not find the solution. https://stackoverflow.com/questions/64428140/native-python3-fails-to-import-sqlite3-on-ubuntu-focal

I also checked the location of _sqlite3.cpython-38-x86_64-linux-gnu.so.

huan@grape:~$ cd /
huan@grape:/$ sudo find -name _sqlite3.cpython-38-x86_64-linux-gnu.so
[sudo] password for huan: 
find: ‘./run/user/1000/doc’: Permission denied
find: ‘./run/user/1000/gvfs’: Permission denied
find: ‘./proc/2196/task/2196/net’: Invalid argument
find: ‘./proc/2196/net’: Invalid argument
./snap/core20/1376/usr/lib/python3.8/lib-dynload/_sqlite3.cpython-38-x86_64-linux-gnu.so
./snap/core20/1361/usr/lib/python3.8/lib-dynload/_sqlite3.cpython-38-x86_64-linux-gnu.so
./usr/lib/python3.8/lib-dynload/_sqlite3.cpython-38-x86_64-linux-gnu.so
huan@grape:/$

It can be found in /usr/lib/python3.8/lib-dynload directory and /snap/core20/1376/usr/lib/python3.8/lib-dynload/ as well as /snap/core20/1361/usr/lib/python3.8/lib-dynload/ directories.

My question is why the non-meaning command "A" will relate to the sqlite3 module of Python3.8? I even did nothing with SQL. How could I solve these annoying returns?

Any suggestion would be greatly appreciated. -- Huan

1 Answer 1

0

I have the same problem but I don't think it is related to Ubuntu 20.04 since I am using Ubuntu 18.04.

In my case (I am working inside a conda environment) the problem is fixed by just reinstalling sqlite.

conda install sqlite --force-reinstall

Hope it helps

1
  • Thanks for your reply. However, it does not work for me.
    – Huan
    Jun 21 at 13:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.