18aaa
18aaa

Reputation: 35

I can't fix "ModuleNotFoundError: No module named 'mysqlite2'"

I installed python3.9 and jupyter notebook on a brand new centos, but I got an error message saying "sqlite3 is missing". So I added sqlite3 and installed it again without deleting python3.9. However, I still get the message that sqlite3 is missing. What should I do?

[jirow04@jirow04 centos 初期インストール設定]$ jupyter notebook
Traceback (most recent call last):
  File "/home/jirow04/.local/lib/python3.9/site-packages/notebook/services/sessions/sessionmanager.py", line 9, in <module>
    import sqlite3
  File "/usr/local/lib/python3.9/sqlite3/__init__.py", line 57, in <module>
    from sqlite3.dbapi2 import *
  File "/usr/local/lib/python3.9/sqlite3/dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ModuleNotFoundError: No module named '_sqlite3'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/jirow04/.local/bin/jupyter-notebook", line 5, in <module>
    from notebook.notebookapp import main
  File "/home/jirow04/.local/lib/python3.9/site-packages/notebook/notebookapp.py", line 83, in <module>
    from .services.sessions.sessionmanager import SessionManager
  File "/home/jirow04/.local/lib/python3.9/site-packages/notebook/services/sessions/sessionmanager.py", line 12, in <module>
    from pysqlite2 import dbapi2 as sqlite3
ModuleNotFoundError: No module named 'pysqlite2'
[jirow04@jirow04 centos 初期インストール設定]$ sqlite3 --version
3.7.17 2013-05-20 00:56:22 118a3b35693b134d56ebd780123b7fd6f1497668

Upvotes: 1

Views: 3465

Answers (1)

LSeu
LSeu

Reputation: 660

I had the problem with python 3.5 a long time ago, I could not run jupyter notebook. I was on ubuntu btw.

to resolve this :

conda install sqlite
conda install python=3.9 

otherwise you can install libsqlite3-dev package and recompile Python.

So, from terminal:

sudo apt-get 
install libsqlite3-dev

And then, from the folder where you downloaded Python:

./configure
make
sudo make install

Upvotes: 3

Related Questions