Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:\scripts\notebooks>jupyter notebook Traceback (most recent call last): File "C:\Users\MYUSERID\AppData\Local\Continuum\anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 10, in import sqlite3 File "C:\Users\MYUSERID\AppData\Local\Continuum\anaconda3\lib\sqlite3__init__.py", line 23, in from sqlite3.dbapi2 import * File "C:\Users\MYUSERID\AppData\Local\Continuum\anaconda3\lib\sqlite3\dbapi2.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:\Users\MYUSERID\AppData\Local\Continuum\anaconda3\Scripts\jupyter-notebook-script.py", line 6, in from notebook.notebookapp import main File "C:\Users\MYUSERID\AppData\Local\Continuum\anaconda3\lib\site-packages\notebook\notebookapp.py", line 86, in from .services.sessions.sessionmanager import SessionManager File "C:\Users\MYUSERID\AppData\Local\Continuum\anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.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
like image 201
vestland Avatar asked Jan 24 '19 12:01

vestland


1 Answers

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 ".\Anaconda\Dlls\". I solved it by simply copying that .dll file from \Anaconda3\Library\bin and put it under the path mentioned above. This was life saviour.

Thanks, Darsan

like image 120
Darsan Avatar answered Oct 03 '22 06:10

Darsan