16

trying to get jupyter (ipython3) running on Python3.5, I installed it using

sudo pip3 install jupyter

However, when trying to launch jupyter notebook I receive the error that the modules _sqlite3 and pysqlite2 are missing. I tried installing them via pip3. For pysqlite2 there seems to be no version availabel (?). For sqlite3 I get

RuntimeError: Package 'sqlite3' must not be downloaded from pypi

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 79, 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'

Any ideas?

4 Answers 4

19

I was missing libsqlite3-dev when building Python3. So after running sudo apt-get install libsqlite3-dev and rebuilding Python3 everything seems to work now.

1
8

I am on Centos 7 and built Python3.8 from source. Indeed as Suppenkasper said I needed to first sudo yum install libsqlite3x-devel.x86_64 before rebuilding Python3.8 using sudo make altinstall.

You can find the exact sqlite package name through yum list | grep sqlite.

1
  • 2
    This is the only right solution for CentOS. Works for py3.9 too Commented Jun 7, 2021 at 15:22
3

I got the same error in jupyter notebook. I have installed python 3.7.2 from source in my tmp folder in Ubuntu 16.04.7 LTS (Xenial Xerus). It was missing libsqlite3-dev So first install libsqlite3-dev using

$ sudo apt-get install libsqlite3-dev

Then rebuild your python 3.7.2, to do this go to your python installed folder in my case /tmp/python-3.7.2 and run

$ cd /tmp/Python-3.7.2
$ ./configure --enable-optimizations
$ sudo make altinstall
1
  • is this still a requirement for using jupytr and/or does it have to be installed before python still?
    – mike01010
    Commented Nov 17, 2023 at 22:32
0

I have to reinstall the python and it works again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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