2

I am trying to run jupyter notebook on a server I have access to but it keeps throwing out this error:

I have tried using pip3 install --user sqlite3 and pip install --user pysqlite2 plus a bunch of other combinations which keeps leading me down a rabbit hole of errors.

Any help would be great.

-bash-4.2$ jupyter notebook
    Traceback (most recent call last):
      File "/data/users/USER/.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 "/data/users/USER/.local/bin/jupyter-notebook", line 6, in <module>
        from notebook.notebookapp import main
      File "/data/users/USER/.local/lib/python3.7/site-packages/notebook/notebookapp.py", line 86, in <module>
        from .services.sessions.sessionmanager import SessionManager
      File "/data/users/USER/.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'

Output1:

-bash-4.2$ hostnamectl
   Static hostname: SERVER_NAME
         Icon name: computer-server
           Chassis: server
        Machine ID: 807cc73fa4ba404192edd7c64de3cf3f
           Boot ID: 279d14738e2548d2b0622b399a9dfd40
  Operating System: Red Hat Enterprise Linux
       CPE OS Name: cpe:/o:redhat:enterprise_linux:7.6:GA:server
            Kernel: Linux 3.10.0-957.10.1.el7.x86_64
      Architecture: x86-64

Output2

-bash-4.2$ yum install sqlite-devel
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
Repo rhel-7-server-rpms forced skip_if_unavailable=True due to: /etc/pki/entitlement/766154663321574841286633-key.pem
You need to be root to perform this command.
user113156
  • 6,761
  • 5
  • 35
  • 81
  • 1
    It might be some missing bindings. Install sqlite-devel (or libsqlite3-dev on some Debian-based systems) This might help you https://stackoverflow.com/questions/1210664/no-module-named-sqlite3 – Rafael Jul 06 '19 at 19:33
  • Looking at the first answer there I try `pip3 install --user libsqlite3-dev Collecting libsqlite3-dev ERROR: Could not find a version that satisfies the requirement libsqlite3-dev (from versions: none) ERROR: No matching distribution found for libsqlite3-dev ` – user113156 Jul 06 '19 at 19:36

1 Answers1

1

So seems like you have multiple Python installations.

Do the following steps:

  1. Go to your home directory
  2. Make a virtual environment using

python3.6 -m venv env

  1. Activate the venv

source env/bin/activate

  1. Install Jupyter

python -m pip install --upgrade pip

python -m pip install jupyter

  1. Run jupyter notebook

jupyter notebook

  1. To open the notebook make sure you put localhost:8888 into your putty tunnel configuration and then open localhost:8888 on your local web browser