Jupyter笔记本从未连接到内核



win10 x64 Python 3.8 Anaconda

我创建了一个conda虚拟环境,激活了环境&使用pip install jupyter ipykernel

安装ipykernel和Jupyter没有问题,安装正常。在命令提示符下输入jupyter notebook启动一个笔记本。

服务器页面打开(Firefox),点击new Python 3 (ipykernel) &新的笔记本打开了,但是没有连接到内核。

在控制台中,我得到以下(重复)…

import win32api
ImportError: DLL load failed while importing win32api: The specified module could not be found.
[W 21:52:45.493 NotebookApp] Replacing stale connection: c3d919e4-1d9d-482b-b3cc-d6bd8f1dde68:727c04bcf32b4ed7b38b8198f457fcb1
[W 21:53:07.534 NotebookApp] Replacing stale connection: c3d919e4-1d9d-482b-b3cc-d6bd8f1dde68:727c04bcf32b4ed7b38b8198f457fcb1
[W 21:53:24.493 NotebookApp] Timeout waiting for kernel_info reply from c3d919e4-1d9d-482b-b3cc-d6bd8f1dde68
[I 21:53:24.509 NotebookApp] Starting buffering for c3d919e4-1d9d-482b-b3cc-d6bd8f1dde68:727c04bcf32b4ed7b38b8198f457fcb1
[I 21:53:24.509 NotebookApp] Restoring connection for c3d919e4-1d9d-482b-b3cc-d6bd8f1dde68:727c04bcf32b4ed7b38b8198f457fcb1
[W 21:53:29.050 NotebookApp] Nudge: attempt 10 on kernel c3d919e4-1d9d-482b-b3cc-d6bd8f1dde68
[W 21:53:34.083 NotebookApp] Nudge: attempt 20 on kernel c3d919e4-1d9d-482b-b3cc-d6bd8f1dde68
[W 21:53:39.119 NotebookApp] Nudge: attempt 30 on kernel c3d919e4-1d9d-482b-b3cc-d6bd8f1dde68
[W 21:53:44.161 NotebookApp] Nudge: attempt 40 on kernel c3d919e4-1d9d-482b-b3cc-d6bd8f1dde68
[W 21:53:49.246 NotebookApp] Nudge: attempt 50 on kernel c3d919e4-1d9d-482b-b3cc-d6bd8f1dde68
[W 21:53:54.345 NotebookApp] Nudge: attempt 60 on kernel c3d919e4-1d9d-482b-b3cc-d6bd8f1dde68
[W 21:53:59.363 NotebookApp] Nudge: attempt 70 on kernel c3d919e4-1d9d-482b-b3cc-d6bd8f1dde68
[W 21:54:04.383 NotebookApp] Nudge: attempt 80 on kernel c3d919e4-1d9d-482b-b3cc-d6bd8f1dde68
[W 21:54:09.402 NotebookApp] Nudge: attempt 90 on kernel c3d919e4-1d9d-482b-b3cc-d6bd8f1dde68
[W 21:54:14.502 NotebookApp] Nudge: attempt 100 on kernel c3d919e4-1d9d-482b-b3cc-d6bd8f1dde68
[W 21:54:19.520 NotebookApp] Nudge: attempt 110 on kernel c3d919e4-1d9d-482b-b3cc-d6bd8f1dde68
[I 21:54:24.295 NotebookApp] Saving file at /Untitled1.ipynb
[W 21:54:24.679 NotebookApp] Nudge: attempt 120 on kernel c3d919e4-1d9d-482b-b3cc-d6bd8f1dde68
[E 21:54:24.679 NotebookApp] Uncaught exception GET /api/kernels/c3d919e4-1d9d-482b-b3cc-d6bd8f1dde68/channels?session_id=727c04bcf32b4ed7b38b8198f457fcb1 (127.0.0.1)
HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/api/kernels/c3d919e4-1d9d-482b-b3cc-d6bd8f1dde68/channels?session_id=727c04bcf32b4ed7b38b8198f457fcb1', version='HTTP/1.1', remote_ip='127.0.0.1')
Traceback (most recent call last):
File "d:opencvcoursesbeginersopencv-envlibsite-packagestornadowebsocket.py", line 956, in _accept_connection
await open_result
File "d:opencvcoursesbeginersopencv-envlibasynciotasks.py", line 349, in __wakeup
future.result()
tornado.util.TimeoutError: Timeout

我检查了pywin32是否安装在环境中,是的,它在那里。

所以我基本上已经回顾了至少4年前关于So的所有问题。

不工作的东西!!

龙卷风降级无效

更改代理服务器设置不起作用。

复制pywin32dll到相应的Windows文件夹不工作。

卸载,重新安装Jupyter无法工作。

删除环境&重新开始不行

在与环境相同的目录下运行Jupyter notebook无法工作。

人吗?

编辑

Jupyter在没有ipykernel的基本环境中工作得很好

起作用的是conda create -n myenv "python=3.8" jupyter看起来pip版本不像conda,看看下面@foglerit的评论。

如果您正在使用VPN,请关闭它并重试。如果您正在使用代理,请禁用它并重试。

最新更新