Jupyter missing _sqlite3 and pysqlite2
Asked Answered
E

4

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?

Exhume answered 8/8, 2017 at 10:0 Comment(0)
E
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.

Exhume answered 8/8, 2017 at 10:36 Comment(1)
Worked for me. Installed the appropriate package (for Fedora) and compiled as instructed here.Devan
M
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.

Microparasite answered 9/10, 2020 at 20:55 Comment(1)
This is the only right solution for CentOS. Works for py3.9 tooBarcarole
G
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
Guillermo answered 29/5, 2021 at 16:50 Comment(1)
is this still a requirement for using jupytr and/or does it have to be installed before python still?Bitterroot
M
0

I have to reinstall the python and it works again.

Mccary answered 8/7, 2019 at 9:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.