4

i am getting a traceback error while running jupyter-notebook. i am providing the screenshot of the traceback call :

Traceback (most recent call last):
   File "/usr/local/lib/python3.7/site-packages/notebook/services/sessions/sessionmanager.py", line 10, in <module>
  import sqlite3
  File "/usr/local/lib/python3.7/sqlite3/__init__.py", line 23, in <module>
  from sqlite3.dbapi2 import *
  File "/usr/local/lib/python3.7/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 "/usr/local/bin/jupyter-notebook", line 7, in <module>
  from notebook.notebookapp import main
  File "/usr/local/lib/python3.7/site-packages/notebook/notebookapp.py", line 85, in <module>
  from .services.sessions.sessionmanager import SessionManager
  File "/usr/local/lib/python3.7/site-packages/notebook/services/sessions/sessionmanager.py", line 13, in <module>
  from pysqlite2 import dbapi2 as sqlite3
  ModuleNotFoundError: No module named 'pysqlite2'
Cad
  • 41

2 Answers2

1

Working purely off these errors:

ModuleNotFoundError: No module named '_sqlite3'

ModuleNotFoundError: No module named 'pysqlite2'

Do this:

$ sudo apt-get install libsqlite3-dev

Python

If the above has been confirmed you can continue by verifying that Python has what it needs to work with sqlite3. First start Python interactively:

$ python
Python 2.7.5 (default, Jul 13 2018, 13:06:57)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

Now check that the sqlite3 module is installed and functioning. Import sqlite3 module:

>>> import sqlite3

Then check version details:

>>> sqlite3.version_info
(2, 6, 0)
>>> sqlite3.sqlite_version
'3.7.17'
>>> sqlite3.dbapi2
<module 'sqlite3.dbapi2' from '/usr/lib64/python2.7/sqlite3/dbapi2.pyc'>
>>>

To exit Python once done, at the >>> prompt: Ctrl+D.

slm
  • 369,824
  • 1
    it is already in the newest version:- apt-get install libsqlite3-dev Reading package lists... Done Building dependency tree
    Reading state information... Done libsqlite3-dev is already the newest version (3.24.0-1).
    – Cad Jul 31 '18 at 11:28
  • 1
    Already installed for me, still got the issue that _sqlite3 not found – btc4cash Apr 15 '19 at 17:37
0

Beware ! Jupiter may be installed in differents ways, from R, conda,... in it's own python environment or distribution (not to mention docker...) and so not be the one you could have installed with your package manager. Check you are looking for the right python !

Obviously from your replies to the other comments (sorry can't comment yet in this SE), I would say your jupyter-notebook isn't installed from your (Ubuntu's) package manager but from somewhere else. We don't have enough information to help you find it.

You may try:

conda install pysqlite sqlite3

or similar.

Best, Samusz

Samusz
  • 1