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
411 views
in Technique[技术] by (71.8m points)

python - Import error while trying to run jupyter notebook

An import error occurs when trying to run jupyter notebook

I'm trying to run jupyter notebook using anaconda (git bash platform), and as I type in jupyter notebook, an import error occurs every time. I tried to lauch it inside an environment, but the same error occured.

$ jupyter notebook

Traceback (most recent call last):

File "C:UsersUserAnaconda3Scriptsjupyter-notebook-script.py", line 6, in
 <module>
from notebook.notebookapp import main
File "C:UsersUserAnaconda3libsite-packages
otebook
otebookapp.py", line 47, in <module>
from zmq.eventloop import ioloop
File "C:UsersUserAnaconda3libsite-packageszmq\__init__.py", line 47, in <module>
from zmq import backend
File "C:UsersUserAnaconda3libsite-packageszmqackend\__init__.py", line 40, in <module>
reraise(*exc_info)
File "C:UsersUserAnaconda3libsite-packageszmqutilssixcerpt.py", line 34, in reraise
raise value
File "C:UsersUserAnaconda3libsite-packageszmqackend\__init__.py", line 27, in <module>
_ns = select_backend(first)
File "C:UsersUserAnaconda3libsite-packageszmqackendselect.py", line 27, in select_backend
mod = __import__(name, fromlist=public_api)
File "C:UsersUserAnaconda3libsite-packageszmqackendcython\__init__.py", line 6, in <module>
from . import (constants, error, message, context,
    ImportError: DLL load failed: The specified module could not be found.

EDITED After reinstalling pyzmq (and I tried reinstalling conda too), the following error occurs:

$ jupyter notebook

Traceback (most recent call last): File "C:UsersUserAnaconda3libsite-packages otebookservicessessionssessionmanager.py", line 10, in import sqlite3

File "C:UsersUserAnaconda3libsqlite3__init__.py", line 23, in from sqlite3.dbapi2 import *

File "C:UsersUserAnaconda3libsqlite3dbapi2.py", line 27, in

from _sqlite3 import *

ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:UsersUserAnaconda3Scriptsjupyter-notebook-script.py", line 6, in

from notebook.notebookapp import main

File "C:UsersUserAnaconda3libsite-packages otebook otebookapp.py", line 86, in

from .services.sessions.sessionmanager import SessionManager

File "C:UsersUserAnaconda3libsite-packages otebookservicessessionssessionmanager.py", line 13, in

from pysqlite2 import dbapi2 as sqlite3

ModuleNotFoundError: No module named 'pysqlite2'

See Question&Answers more detail:os

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

1 Reply

0 votes
by (71.8m points)

I found a similar issue open on GitHub for zmq. The recommendation by GitHub user harsh23tyagi that seems to work for most is to run the following:

pip uninstall pyzmq
pip install pyzmq

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

...