Skip to content
Advertisement

Running Jupyter Notebook from cmd raises ModuleNotFoundError: No module named pysqlite2

The problem:

After reinstalling Anaconda I can no longer navigate to a folder using the command window where I’ve got some .pynb files, type jupyter notebook and get things up and running. I’m getting these errors:

C:scriptsnotebooks>jupyter notebook Traceback (most recent call last): File “C:UsersMYUSERIDAppDataLocalContinuumanaconda3libsite-packagesnotebookservicessessionssessionmanager.py”, line 10, in import sqlite3 File “C:UsersMYUSERIDAppDataLocalContinuumanaconda3libsqlite3__init__.py”, line 23, in from sqlite3.dbapi2 import * File “C:UsersMYUSERIDAppDataLocalContinuumanaconda3libsqlite3dbapi2.py”, line 27, in from _sqlite3 import * ImportError: DLL load failed: Procedyre not found

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File “C:UsersMYUSERIDAppDataLocalContinuumanaconda3Scriptsjupyter-notebook-script.py”, line 6, in from notebook.notebookapp import main File “C:UsersMYUSERIDAppDataLocalContinuumanaconda3libsite-packagesnotebooknotebookapp.py”, line 86, in from .services.sessions.sessionmanager import SessionManager File “C:UsersMYUSERIDAppDataLocalContinuumanaconda3libsite-packagesnotebookservicessessionssessionmanager.py”, line 13, in from pysqlite2 import dbapi2 as sqlite3 ModuleNotFoundError: No module named ‘pysqlite2’


What I’ve tried:


I’ve checked the fresh Anaconda folders, and everything seems to be where it should wrt sqlite, sqlite3 and pysqlite2.

Since last time I downloaded Anaconda, it seems they’ve changed the default install folders, so I was sure everything would be OK after editing my user and system environment variables according to the post Jupyter notebook will not open from command prompt just in case checking the Add to Path option upon reinstalling Anaconda was not enough. But I’m still getting the same error messages.

When I launch Jupyter from the Anaconda Navigator, everything runs fine.

A similar question has been asked, but not answered, for Ubuntu here: 2x ModuleNotFoundError Jupyter notebook


Edit:


When I use and Anaconda Prompt, jupyter also starts running just fine when entering jupyter notebook. So why bother with the command window? The anaconda prompt command does not open ipynb files automatically in the deafault web browser. My earlier setup with the windows command window (and a batch file) did that and I think it was very useful.


System details:

Windows 7, 64 bit
Anaconda 2018.12
Jupyter Notebook 5.7.4
Python 3.7.1
IPython 7.2.0

Advertisement

Answer

I was stuck on the same issue for like a day. finally found the solution its working now.

The issue seems to arise from the missing of sqlite3.dll in path “.AnacondaDlls”. I solved it by simply copying that .dll file from Anaconda3Librarybin and put it under the path mentioned above. This was life saviour.

Thanks, Darsan

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement