【问题标题】:Jupyter notebook does not run any commandJupyter notebook 不运行任何命令
【发布时间】:2019-03-18 21:37:10
【问题描述】:

我无法在 jupyter notebook 中运行任何命令。

handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
ValueError: signal only works in main thread
ERROR:tornado.application:Exception in callback (<zmq.sugar.socket.Socket object at 0x04378E70>, <function wrap.<locals>.null_wrapper at 0x0437CD68>)
Traceback (most recent call last):
  File "c:\python27\lib\site-packages\tornado\ioloop.py", line 888, in start
    handler_func(fd_obj, events)
  File "c:\python27\lib\site-packages\tornado\stack_context.py", line 277, in null_wrapper
    return fn(*args, **kwargs)
  File "c:\python27\lib\site-packages\zmq\eventloop\zmqstream.py", line 450, in _handle_events
    self._handle_recv()
  File "c:\python27\lib\site-packages\zmq\eventloop\zmqstream.py", line 480, in _handle_recv
    self._run_callback(callback, msg)
  File "c:\python27\lib\site-packages\zmq\eventloop\zmqstream.py", line 432, in _run_callback
    callback(*args, **kwargs)
  File "c:\python27\lib\site-packages\tornado\stack_context.py", line 277, in null_wrapper
    return fn(*args, **kwargs)
  File "c:\python27\lib\site-packages\ipykernel\kernelbase.py", line 283, in dispatcher
    return self.dispatch_shell(stream, msg)
  File "c:\python27\lib\site-packages\ipykernel\kernelbase.py", line 233, in dispatch_shell
    self.pre_handler_hook()
  File "c:\python27\lib\site-packages\ipykernel\kernelbase.py", line 248, in pre_handler_hook
    self.saved_sigint_handler = signal(SIGINT, default_int_handler)
  File "c:\python27\lib\signal.py", line 47, in signal
    handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
ValueError: signal only works in main thread
[I 10:57:51.456 NotebookApp] Kernel shutdown: fbbad76c-f291-476b-9307-f3789746cf4c

请考虑以下几点。

  1. 当我运行任何命令说简单的 print('hello') 时,单元格会无限期地运行。

  2. 我使用

    安装了深色主题

    pip install jupyterthemes jt -t onedork

  3. 上面有错误,我将 pip 从 18.0 升级到 18.1,然后将 jupyter notebook 从 4.3 升级到 4.4。

  4. 直到昨天都正常工作。

  5. 从早上开始,我遇到了这个问题,我尝试卸载并重新安装不起作用的 jupyter notebook,然后将 pip 从 18.1 降级到 18.0,卸载并重新安装 jupyter notebook。但它没有用。

  6. 我使用 jt -r 将 jupyter 主题改回原来的主题,但没有解决方案。

  7. 我昨天还为我的 Firefox 添加了深色主题(深色阅读器)并将其禁用。但同样的情况。

  8. 我再次重新安装了 notebook 4.3 版本,但出现警告

    Requirement already satisfied: webencodings in c:\python27\lib\site-packages (from html5lib>=0.99999999->bleach->nbconvert->notebook==4.3) (0.5.1) widgetsnbextension 2.0.0 has requirement notebook>=4.4.1, but you'll have notebook 4.3.0 which is incompatible. jupyterthemes 0.19.6 has requirement notebook>=5.6.0, but you'll have notebook 4.3.0 which is incompatible. Installing collected packages: notebook Found existing installation: notebook 5.7.0 Uninstalling notebook-5.7.0: Successfully uninstalled notebook-5.7.0 Successfully installed notebook-4.3.0 You are using pip version 18.0, however version 18.1 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command.

但没有任何效果。

  1. 我正在使用 窗户 10。 蟒蛇 3.6 点 18.0 jupyter notebook 4.3.0

请帮助,如果需要其他信息,请告诉我。我试图搜索类似的问题,但无法获得解决方案。

【问题讨论】:

  • 为什么要安装主题,给python3 -m pip install jupyterpip3 install jupyter简单拍。另外,请确保安装了ipython。我不确定 jupyter 是否在内部安装它。参考:jupyter.org/install
  • 我在安装深色主题后开始遇到这个问题。我后来删除了。不知道是什么问题。 python,jupyter notebook 一切正常。我有另一个通过 anaconda 获得的 jupyter notebook 实例。此外,一切似乎都适用于另一个。我试过通过python的IDLE运行命令。一切正常。但是我上面提到的那个是我大部分时间都在工作的主要版本,它也是更高版本。所以我请求一些帮助来帮助我恢复广告投放。

标签: python jupyter-notebook jupyter


【解决方案1】:

我遇到了同样的问题。首先,我检查了命令提示符日志。错误是:

ERROR:tornado.general:zmqstream 回调中未捕获的异常

以及对我有用的解决方案:

通过命令卸载 goole-colab 并升级 ipykernel:

pip 卸载 google-colab

pip install --upgrade ipykernel

参考:Jupyter Notebook dead Kernel after Anaconda update

【讨论】:

    猜你喜欢
    • 2019-11-24
    • 2023-04-05
    • 2019-12-20
    • 2017-11-20
    • 2022-07-20
    • 1970-01-01
    • 2019-04-09
    • 2019-07-13
    • 1970-01-01
    相关资源
    最近更新 更多