Import error while trying to run jupyter notebook

只愿长相守 提交于 2020-02-05 13:10:09

问题


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:\Users\User\Anaconda3\Scripts\jupyter-notebook-script.py", line 6, in
 <module>
from notebook.notebookapp import main
File "C:\Users\User\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 47, in <module>
from zmq.eventloop import ioloop
File "C:\Users\User\Anaconda3\lib\site-packages\zmq\__init__.py", line 47, in <module>
from zmq import backend
File "C:\Users\User\Anaconda3\lib\site-packages\zmq\backend\__init__.py", line 40, in <module>
reraise(*exc_info)
File "C:\Users\User\Anaconda3\lib\site-packages\zmq\utils\sixcerpt.py", line 34, in reraise
raise value
File "C:\Users\User\Anaconda3\lib\site-packages\zmq\backend\__init__.py", line 27, in <module>
_ns = select_backend(first)
File "C:\Users\User\Anaconda3\lib\site-packages\zmq\backend\select.py", line 27, in select_backend
mod = __import__(name, fromlist=public_api)
File "C:\Users\User\Anaconda3\lib\site-packages\zmq\backend\cython\__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:\Users\User\Anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 10, in import sqlite3

File "C:\Users\User\Anaconda3\lib\sqlite3__init__.py", line 23, in from sqlite3.dbapi2 import *

File "C:\Users\User\Anaconda3\lib\sqlite3\dbapi2.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:\Users\User\Anaconda3\Scripts\jupyter-notebook-script.py", line 6, in

from notebook.notebookapp import main

File "C:\Users\User\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 86, in

from .services.sessions.sessionmanager import SessionManager

File "C:\Users\User\Anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 13, in

from pysqlite2 import dbapi2 as sqlite3

ModuleNotFoundError: No module named 'pysqlite2'


回答1:


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


来源:https://stackoverflow.com/questions/54224969/import-error-while-trying-to-run-jupyter-notebook

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!