Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
641 views
in Technique[技术] by (71.8m points)

python - 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 otebooks>jupyter notebook Traceback (most recent call last): File "C:UsersMYUSERIDAppDataLocalContinuumanaconda3libsite-packages otebookservicessessionssessionmanager.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-packages otebook otebookapp.py", line 86, in from .services.sessions.sessionmanager import SessionManager File "C:UsersMYUSERIDAppDataLocalContinuumanaconda3libsite-packages otebookservicessessionssessionmanager.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
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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 Anaconda3Libraryin and put it under the path mentioned above. This was life saviour.

Thanks, Darsan


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...