veilupearl
veilupearl

Reputation: 929

How do I resolve ImportError: No module named '_sqlite3' and No module named 'pysqlite2' python 3.5

Installing jupyter notebook from jupyter

Python3 version

Python 3.5.2

pip list

jupyter (1.0.0)
jupyter-client (5.2.3)
jupyter-console (5.2.0)
jupyter-core (4.4.0)

Running jupyter notebook

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/notebook/services/sessions/sessionmanager.py", line 10, in <module>
    import sqlite3
  File "/usr/local/lib/python3.5/sqlite3/__init__.py", line 23, in <module>
    from sqlite3.dbapi2 import *
  File "/usr/local/lib/python3.5/sqlite3/dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ImportError: 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.5/site-packages/notebook/notebookapp.py", line 83, in <module>
    from .services.sessions.sessionmanager import SessionManager
  File "/usr/local/lib/python3.5/site-packages/notebook/services/sessions/sessionmanager.py", line 13, in <module>
    from pysqlite2 import dbapi2 as sqlite3
ImportError: No module named 'pysqlite2'

Also tried sudo apt-get install libsqlite3-dev from No module named _sqlite3

How to resolve the above error?

Upvotes: 0

Views: 3307

Answers (1)

russoue
russoue

Reputation: 5720

To fix the import error for _sqlite3 I did the following:

After this python -c 'import _sqlite3' succeeded when I used the alternate installation in /usr/local/bin/python. I believe you can install Python3 from the source like this and use it.

Upvotes: 1

Related Questions