Jupyter无法连接到本地内核(ubuntu 18.04)

时间:2019-03-04 19:33:26

标签: python jupyter-notebook

由于某种原因,我无法连接到jupyter笔记本中的python内核。这完全让人感到困惑,因为2周前我没有任何问题。我去度假了,因此,我没有更改任何配置。

我使用

创建了一个虚拟环境
$ python3 -m venv venv

然后,我激活了虚拟环境

$ source venv/bin/activate

这是虚拟环境的python软件包列表

(venv)$ pip list
pip (9.0.1)
pkg-resources (0.0.0)
setuptools (39.0.1)

现在,我安装了jupyter

(venv) $ pip install jupyter
Collecting jupyter
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/83/df/0f5dd132200728a86190397e1ea87cd76244e42d39ec5e88efd25b2abd7e/jupyter-1.0.0-py2.py3-none-any.whl
Collecting jupyter-console (from jupyter)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/cb/ee/6374ae8c21b7d0847f9c3722dcdfac986b8e54fa9ad9ea66e1eb6320d2b8/jupyter_console-6.0.0-py2.py3-none-any.whl
Collecting ipykernel (from jupyter)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/d8/b0/f0be5c5ab335196f5cce96e5b889a4fcf5bfe462eb0acc05cd7e2caf65eb/ipykernel-5.1.0-py3-none-any.whl
Collecting qtconsole (from jupyter)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/e0/7a/8aefbc0ed078dec7951ac9a06dcd1869243ecd7bcbce26fa47bf5e469a8f/qtconsole-4.4.3-py2.py3-none-any.whl
Collecting nbconvert (from jupyter)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/b8/39/1e67fea74dc9577cc49f9863fe3ec824e525d1304ab6027d95a94cd586f5/nbconvert-5.4.1-py2.py3-none-any.whl
Collecting ipywidgets (from jupyter)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/30/9a/a008c7b1183fac9e52066d80a379b3c64eab535bd9d86cdc29a0b766fd82/ipywidgets-7.4.2-py2.py3-none-any.whl
Collecting notebook (from jupyter)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/f8/a6/dbdf0954d073ab2cf5421cad20334d1e4c780da37205c04522c045298f67/notebook-5.7.4-py2.py3-none-any.whl
Collecting jupyter-client (from jupyter-console->jupyter)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/3b/c3/3043fe9ffd140d03c9d091a056794ccdc427c56ec19b8eea74f9ea0a498f/jupyter_client-5.2.4-py2.py3-none-any.whl
Collecting pygments (from jupyter-console->jupyter)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/13/e5/6d710c9cf96c31ac82657bcfb441df328b22df8564d58d0c4cd62612674c/Pygments-2.3.1-py2.py3-none-any.whl
Collecting ipython (from jupyter-console->jupyter)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/14/3b/3fcf422a99a04ee493e6a4fc3014e3c8ff484a7feed238fef68bdc285085/ipython-7.3.0-py3-none-any.whl
Collecting prompt-toolkit<2.1.0,>=2.0.0 (from jupyter-console->jupyter)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/f7/a7/9b1dd14ef45345f186ef69d175bdd2491c40ab1dfa4b2b3e4352df719ed7/prompt_toolkit-2.0.9-py3-none-any.whl
Collecting tornado>=4.2 (from ipykernel->jupyter)
  Cache entry deserialization failed, entry ignored
Collecting traitlets>=4.1.0 (from ipykernel->jupyter)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/93/d6/abcb22de61d78e2fc3959c964628a5771e47e7cc60d53e9342e21ed6cc9a/traitlets-4.3.2-py2.py3-none-any.whl
Collecting jupyter-core (from qtconsole->jupyter)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/1d/44/065d2d7bae7bebc06f1dd70d23c36da8c50c0f08b4236716743d706762a8/jupyter_core-4.4.0-py2.py3-none-any.whl
Collecting ipython-genutils (from qtconsole->jupyter)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/fa/bc/9bd3b5c2b4774d5f33b2d544f1460be9df7df2fe42f352135381c347c69a/ipython_genutils-0.2.0-py2.py3-none-any.whl
Collecting jinja2 (from nbconvert->jupyter)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/7f/ff/ae64bacdfc95f27a016a7bed8e8686763ba4d277a78ca76f32659220a731/Jinja2-2.10-py2.py3-none-any.whl
Collecting nbformat>=4.4 (from nbconvert->jupyter)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/da/27/9a654d2b6cc1eaa517d1c5a4405166c7f6d72f04f6e7eea41855fe808a46/nbformat-4.4.0-py2.py3-none-any.whl
Collecting defusedxml (from nbconvert->jupyter)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/87/1c/17f3e3935a913dfe2a5ca85fa5ccbef366bfd82eb318b1f75dadbf0affca/defusedxml-0.5.0-py2.py3-none-any.whl
Collecting mistune>=0.8.1 (from nbconvert->jupyter)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/09/ec/4b43dae793655b7d8a25f76119624350b4d65eb663459eb9603d7f1f0345/mistune-0.8.4-py2.py3-none-any.whl
Collecting testpath (from nbconvert->jupyter)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/be/a4/162f9ebb6489421fe46dcca2ae420369edfee4b563c668d93cb4605d12ba/testpath-0.4.2-py2.py3-none-any.whl
Collecting pandocfilters>=1.4.1 (from nbconvert->jupyter)
  Cache entry deserialization failed, entry ignored
Collecting bleach (from nbconvert->jupyter)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/ab/05/27e1466475e816d3001efb6e0a85a819be17411420494a1e602c36f8299d/bleach-3.1.0-py2.py3-none-any.whl
Collecting entrypoints>=0.2.2 (from nbconvert->jupyter)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/ac/c6/44694103f8c221443ee6b0041f69e2740d89a25641e62fb4f2ee568f2f9c/entrypoints-0.3-py2.py3-none-any.whl
Collecting widgetsnbextension~=3.4.0 (from ipywidgets->jupyter)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/8a/81/35789a3952afb48238289171728072d26d6e76649ddc8b3588657a2d78c1/widgetsnbextension-3.4.2-py2.py3-none-any.whl
Collecting prometheus-client (from notebook->jupyter)
  Cache entry deserialization failed, entry ignored
Collecting pyzmq>=17 (from notebook->jupyter)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/27/5a/8ce70c20efaf78fac2524b2f8d98b7360c997bc11a748dd233f3add7507e/pyzmq-18.0.0-cp36-cp36m-manylinux1_x86_64.whl
Collecting Send2Trash (from notebook->jupyter)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/49/46/c3dc27481d1cc57b9385aff41c474ceb7714f7935b1247194adae45db714/Send2Trash-1.5.0-py3-none-any.whl
Collecting terminado>=0.8.1 (from notebook->jupyter)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/2e/20/a26211a24425923d46e1213b376a6ee60dc30bcdf1b0c345e2c3769deb1c/terminado-0.8.1-py2.py3-none-any.whl
Collecting python-dateutil>=2.1 (from jupyter-client->jupyter-console->jupyter)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/41/17/c62faccbfbd163c7f57f3844689e3a78bae1f403648a6afb1d0866d87fbb/python_dateutil-2.8.0-py2.py3-none-any.whl
Collecting jedi>=0.10 (from ipython->jupyter-console->jupyter)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/25/2b/1f188901be099d52d7b06f4d3b7cb9f8f09692c50697b139eaf6fa2928d8/jedi-0.13.3-py2.py3-none-any.whl
Collecting backcall (from ipython->jupyter-console->jupyter)
  Cache entry deserialization failed, entry ignored
Collecting decorator (from ipython->jupyter-console->jupyter)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/f1/cd/7c8240007e9716b14679bc217a1baefa4432aa30394f7e2ec40a52b1a708/decorator-4.3.2-py2.py3-none-any.whl
Collecting pexpect; sys_platform != "win32" (from ipython->jupyter-console->jupyter)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/89/e6/b5a1de8b0cc4e07ca1b305a4fcc3f9806025c1b651ea302646341222f88b/pexpect-4.6.0-py2.py3-none-any.whl
Collecting pickleshare (from ipython->jupyter-console->jupyter)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/9a/41/220f49aaea88bc6fa6cba8d05ecf24676326156c23b991e80b3f2fc24c77/pickleshare-0.7.5-py2.py3-none-any.whl
Requirement already satisfied: setuptools>=18.5 in ./venv/lib/python3.6/site-packages (from ipython->jupyter-console->jupyter)
Collecting wcwidth (from prompt-toolkit<2.1.0,>=2.0.0->jupyter-console->jupyter)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/7e/9f/526a6947247599b084ee5232e4f9190a38f398d7300d866af3ab571a5bfe/wcwidth-0.1.7-py2.py3-none-any.whl
Collecting six>=1.9.0 (from prompt-toolkit<2.1.0,>=2.0.0->jupyter-console->jupyter)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Collecting MarkupSafe>=0.23 (from jinja2->nbconvert->jupyter)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/b2/5f/23e0023be6bb885d00ffbefad2942bc51a620328ee910f64abe5a8d18dd1/MarkupSafe-1.1.1-cp36-cp36m-manylinux1_x86_64.whl
Collecting jsonschema!=2.5.0,>=2.4 (from nbformat>=4.4->nbconvert->jupyter)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/aa/69/df679dfbdd051568b53c38ec8152a3ab6bc533434fc7ed11ab034bf5e82f/jsonschema-3.0.1-py2.py3-none-any.whl
Collecting webencodings (from bleach->nbconvert->jupyter)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/f4/24/2a3e3df732393fed8b3ebf2ec078f05546de641fe1b667ee316ec1dcf3b7/webencodings-0.5.1-py2.py3-none-any.whl
Collecting ptyprocess; os_name != "nt" (from terminado>=0.8.1->notebook->jupyter)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/d1/29/605c2cc68a9992d18dada28206eeada56ea4bd07a239669da41674648b6f/ptyprocess-0.6.0-py2.py3-none-any.whl
Collecting parso>=0.3.0 (from jedi>=0.10->ipython->jupyter-console->jupyter)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/19/b1/522b2671cc6d134c9d3f5dfc0d02fee07cab848e908d03d2bffea78cca8f/parso-0.3.4-py2.py3-none-any.whl
Collecting pyrsistent>=0.14.0 (from jsonschema!=2.5.0,>=2.4->nbformat>=4.4->nbconvert->jupyter)
  Cache entry deserialization failed, entry ignored
Collecting attrs>=17.4.0 (from jsonschema!=2.5.0,>=2.4->nbformat>=4.4->nbconvert->jupyter)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/23/96/d828354fa2dbdf216eaa7b7de0db692f12c234f7ef888cc14980ef40d1d2/attrs-19.1.0-py2.py3-none-any.whl
Installing collected packages: tornado, six, decorator, ipython-genutils, traitlets, jupyter-core, python-dateutil, pyzmq, jupyter-client, parso, jedi, pygments, backcall, ptyprocess, pexpect, pickleshare, wcwidth, prompt-toolkit, ipython, ipykernel, jupyter-console, qtconsole, MarkupSafe, jinja2, pyrsistent, attrs, jsonschema, nbformat, defusedxml, mistune, testpath, pandocfilters, webencodings, bleach, entrypoints, nbconvert, prometheus-client, Send2Trash, terminado, notebook, widgetsnbextension, ipywidgets, jupyter
Successfully installed MarkupSafe-1.1.1 Send2Trash-1.5.0 attrs-19.1.0 backcall-0.1.0 bleach-3.1.0 decorator-4.3.2 defusedxml-0.5.0 entrypoints-0.3 ipykernel-5.1.0 ipython-7.3.0 ipython-genutils-0.2.0 ipywidgets-7.4.2 jedi-0.13.3 jinja2-2.10 jsonschema-3.0.1 jupyter-1.0.0 jupyter-client-5.2.4 jupyter-console-6.0.0 jupyter-core-4.4.0 mistune-0.8.4 nbconvert-5.4.1 nbformat-4.4.0 notebook-5.7.4 pandocfilters-1.4.2 parso-0.3.4 pexpect-4.6.0 pickleshare-0.7.5 prometheus-client-0.6.0 prompt-toolkit-2.0.9 ptyprocess-0.6.0 pygments-2.3.1 pyrsistent-0.14.11 python-dateutil-2.8.0 pyzmq-18.0.0 qtconsole-4.4.3 six-1.12.0 terminado-0.8.1 testpath-0.4.2 tornado-6.0.1 traitlets-4.3.2 wcwidth-0.1.7 webencodings-0.5.1 widgetsnbextension-3.4.2

这是虚拟环境中python软件包的新列表:

(venv) $ pip list
attrs (19.1.0)
backcall (0.1.0)
bleach (3.1.0)
decorator (4.3.2)
defusedxml (0.5.0)
entrypoints (0.3)
ipykernel (5.1.0)
ipython (7.3.0)
ipython-genutils (0.2.0)
ipywidgets (7.4.2)
jedi (0.13.3)
Jinja2 (2.10)
jsonschema (3.0.1)
jupyter (1.0.0)
jupyter-client (5.2.4)
jupyter-console (6.0.0)
jupyter-core (4.4.0)
MarkupSafe (1.1.1)
mistune (0.8.4)
nbconvert (5.4.1)
nbformat (4.4.0)
notebook (5.7.4)
pandocfilters (1.4.2)
parso (0.3.4)
pexpect (4.6.0)
pickleshare (0.7.5)
pip (9.0.1)
pkg-resources (0.0.0)
prometheus-client (0.6.0)
prompt-toolkit (2.0.9)
ptyprocess (0.6.0)
Pygments (2.3.1)
pyrsistent (0.14.11)
python-dateutil (2.8.0)
pyzmq (18.0.0)
qtconsole (4.4.3)
Send2Trash (1.5.0)
setuptools (39.0.1)
six (1.12.0)
terminado (0.8.1)
testpath (0.4.2)
tornado (6.0.1)
traitlets (4.3.2)
wcwidth (0.1.7)
webencodings (0.5.1)
widgetsnbextension (3.4.2)

最后,我开始玩jupyter

(venv) $ jupyter notebook

浏览器打开,我创建了一个新的笔记本,并且发生了这种情况:

enter image description here

这是我在Firefox检查器控制台中拥有的内容:

enter image description here

这就是我在终端中所拥有的:

enter image description here

我在Firefox,Chromium和Chrome中遇到相同的问题。几个小时前,当我不使用任何虚拟环境时,我能够使其工作。但是,为了搜索可能导致这种情况的原因,我从系统环境中删除了一些依赖项,现在我得到了相同的结果(即无法在jupyter中使用python内核)。

很抱歉,如果我缺少任何东西...我花了整整一个下午的时间来尝试完成这项工作,而我完全受够了。我为此损失了几乎一整天。我以前从未遇到过这个问题。

顺便说一句,我正在使用Ubuntu 18.04:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.2 LTS
Release:    18.04
Codename:   bionic

0 个答案:

没有答案