簡體   English   中英

jupyter-console 無法啟動,但 jupyter-notebook 很好

[英]jupyter-console fails to start, but jupyter-notebook is fine

我可以啟動 jupyter-notebook 但不能啟動 jupyter-console。 在Mac上的開發的virtualenv,它會嘗試導入cast_unicode_py2IPython.utils.py3compat ,但cast_unicode_py2無法導入:

(dev) C02ZV35VLVDL:profile_default harvey$ jupyter-console
Traceback (most recent call last):
  File "/Users/harvey/dev/bin/jupyter-console", line 5, in <module>
    from jupyter_console.app import main
  File "/Users/harvey/dev/lib/python3.7/site-packages/jupyter_console/app.py", line 26, in <module>
    from jupyter_console.ptshell import ZMQTerminalInteractiveShell
  File "/Users/harvey/dev/lib/python3.7/site-packages/jupyter_console/ptshell.py", line 22, in <module>
    from IPython.utils.py3compat import cast_unicode_py2, input
ImportError: cannot import name 'cast_unicode_py2' from 'IPython.utils.py3compat' (/Users/harvey/dev/lib/python3.7/site-packages/IPython/utils/py3compat.py)

簡短的回答:

作為臨時解決方法,您可以將jupyter_console/jupyter_console/ptshell.py 的第 22 行更改為:

from ipython_genutils.py3compat import cast_unicode_py2, input

在您的計算機上,要編輯的文件是/Users/harvey/dev/lib/python3.7/site-packages/jupyter_console/ptshell.py

更長的答案:

Jupyter 控制台正在嘗試從IPython.utils.py3compat導入cast_unicode_py2input ,但它們已被移至ipython_genutils.py3compat 這在Jupyter 控制台的 master 分支中尚未修復

將 ipython 降級到以前的版本后,它又可以工作了。 我猜cast_unicode_py2已棄用。

現在 anaconda 出現了一些問題,因為即使使用全新的虛擬環境,jupyter-console 也會產生相同類型的錯誤,即使源服務器上的ptshell.py 文件已更改為您推薦的格式。 我懂了

Traceback (most recent call last):
  File "/home/pauljohn/LinuxDownloads/anaconda3/envs/fuzzymatch/bin/jupyter-console", line 7, in <module>
    from jupyter_console.app import main
  File "/home/pauljohn/LinuxDownloads/anaconda3/envs/fuzzymatch/lib/python3.7/site-packages/jupyter_console/app.py", line 26, in <module>
    from jupyter_console.ptshell import ZMQTerminalInteractiveShell
  File "/home/pauljohn/LinuxDownloads/anaconda3/envs/fuzzymatch/lib/python3.7/site-packages/jupyter_console/ptshell.py", line 22, in <module>
    from IPython.utils.py3compat import cast_unicode_py2, input
ImportError: cannot import name 'cast_unicode_py2' from 'IPython

此輸出是否為您提供了足夠的信息來猜測出了什么問題?

$ conda list --explicit
# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: linux-64
@EXPLICIT
https://repo.anaconda.com/pkgs/main/linux-64/_libgcc_mutex-0.1-main.conda
https://repo.anaconda.com/pkgs/main/linux-64/ca-certificates-2019.11.27-0.conda
https://repo.anaconda.com/pkgs/main/linux-64/ld_impl_linux-64-2.33.1-h53a641e_7.conda
https://repo.anaconda.com/pkgs/main/linux-64/libstdcxx-ng-9.1.0-hdf63c60_0.conda
https://repo.anaconda.com/pkgs/main/linux-64/libgcc-ng-9.1.0-hdf63c60_0.conda
https://repo.anaconda.com/pkgs/main/linux-64/expat-2.2.6-he6710b0_0.conda
https://repo.anaconda.com/pkgs/main/linux-64/gmp-6.1.2-h6c8ec71_1.conda
https://repo.anaconda.com/pkgs/main/linux-64/icu-58.2-h9c2bf20_1.conda
https://repo.anaconda.com/pkgs/main/linux-64/jpeg-9b-h024ee3a_2.conda
https://repo.anaconda.com/pkgs/main/linux-64/libffi-3.2.1-hd88cf55_4.conda
https://repo.anaconda.com/pkgs/main/linux-64/libsodium-1.0.16-h1bed415_0.conda
https://repo.anaconda.com/pkgs/main/linux-64/libuuid-1.0.3-h1bed415_2.conda
https://repo.anaconda.com/pkgs/main/linux-64/libxcb-1.13-h1bed415_1.conda
https://repo.anaconda.com/pkgs/main/linux-64/ncurses-6.1-he6710b0_1.conda
https://repo.anaconda.com/pkgs/main/linux-64/openssl-1.1.1d-h7b6447c_3.conda
https://repo.anaconda.com/pkgs/main/linux-64/pcre-8.43-he6710b0_0.conda
https://repo.anaconda.com/pkgs/main/linux-64/xz-5.2.4-h14c3975_4.conda
https://repo.anaconda.com/pkgs/main/linux-64/zlib-1.2.11-h7b6447c_3.conda
https://repo.anaconda.com/pkgs/main/linux-64/glib-2.63.1-h5a9c865_0.conda
https://repo.anaconda.com/pkgs/main/linux-64/libedit-3.1.20181209-hc058e9b_0.conda
https://repo.anaconda.com/pkgs/main/linux-64/libpng-1.6.37-hbc83047_0.conda
https://repo.anaconda.com/pkgs/main/linux-64/libxml2-2.9.9-hea5a465_1.conda
https://repo.anaconda.com/pkgs/main/linux-64/pandoc-2.2.3.2-0.conda
https://repo.anaconda.com/pkgs/main/linux-64/readline-7.0-h7b6447c_5.conda
https://repo.anaconda.com/pkgs/main/linux-64/tk-8.6.8-hbc83047_0.conda
https://repo.anaconda.com/pkgs/main/linux-64/zeromq-4.3.1-he6710b0_3.conda
https://repo.anaconda.com/pkgs/main/linux-64/dbus-1.13.12-h746ee38_0.conda
https://repo.anaconda.com/pkgs/main/linux-64/freetype-2.9.1-h8a8886c_1.conda
https://repo.anaconda.com/pkgs/main/linux-64/gstreamer-1.14.0-hb453b48_1.conda
https://repo.anaconda.com/pkgs/main/linux-64/sqlite-3.30.1-h7b6447c_0.conda
https://repo.anaconda.com/pkgs/main/linux-64/fontconfig-2.13.0-h9420a91_0.conda
https://repo.anaconda.com/pkgs/main/linux-64/gst-plugins-base-1.14.0-hbbd80ab_1.conda
https://repo.anaconda.com/pkgs/main/linux-64/python-3.7.6-h0371630_2.conda
https://repo.anaconda.com/pkgs/main/noarch/attrs-19.3.0-py_0.tar.bz2
https://repo.anaconda.com/pkgs/main/linux-64/backcall-0.1.0-py37_0.conda
https://repo.anaconda.com/pkgs/main/linux-64/certifi-2019.11.28-py37_0.conda
https://repo.anaconda.com/pkgs/main/noarch/decorator-4.4.1-py_0.tar.bz2
https://repo.anaconda.com/pkgs/main/noarch/defusedxml-0.6.0-py_0.tar.bz2
https://repo.anaconda.com/pkgs/main/linux-64/entrypoints-0.3-py37_0.conda
https://repo.anaconda.com/pkgs/main/linux-64/ipython_genutils-0.2.0-py37_0.conda
https://repo.anaconda.com/pkgs/main/linux-64/markupsafe-1.1.1-py37h7b6447c_0.conda
https://repo.anaconda.com/pkgs/main/linux-64/mistune-0.8.4-py37h7b6447c_0.conda
https://repo.anaconda.com/pkgs/main/noarch/more-itertools-8.0.2-py_0.conda
https://repo.anaconda.com/pkgs/main/linux-64/pandocfilters-1.4.2-py37_1.conda
https://repo.anaconda.com/pkgs/main/noarch/parso-0.5.2-py_0.conda
https://repo.anaconda.com/pkgs/main/linux-64/pickleshare-0.7.5-py37_0.conda
https://repo.anaconda.com/pkgs/main/noarch/prometheus_client-0.7.1-py_0.tar.bz2
https://repo.anaconda.com/pkgs/main/linux-64/ptyprocess-0.6.0-py37_0.conda
https://repo.anaconda.com/pkgs/main/linux-64/pyzmq-18.1.0-py37he6710b0_0.conda
https://repo.anaconda.com/pkgs/main/linux-64/qt-5.9.7-h5867ecd_1.conda
https://repo.anaconda.com/pkgs/main/linux-64/send2trash-1.5.0-py37_0.conda
https://repo.anaconda.com/pkgs/main/linux-64/sip-4.19.8-py37hf484d3e_0.conda
https://repo.anaconda.com/pkgs/main/linux-64/six-1.13.0-py37_0.conda
https://repo.anaconda.com/pkgs/main/noarch/testpath-0.4.4-py_0.tar.bz2
https://repo.anaconda.com/pkgs/main/linux-64/tornado-6.0.3-py37h7b6447c_0.conda
https://repo.anaconda.com/pkgs/main/linux-64/wcwidth-0.1.7-py37_0.conda
https://repo.anaconda.com/pkgs/main/linux-64/webencodings-0.5.1-py37_1.conda
https://repo.anaconda.com/pkgs/main/linux-64/jedi-0.15.2-py37_0.conda
https://repo.anaconda.com/pkgs/main/linux-64/pexpect-4.7.0-py37_0.conda
https://repo.anaconda.com/pkgs/main/linux-64/pyqt-5.9.2-py37h05f1152_2.conda
https://repo.anaconda.com/pkgs/main/linux-64/pyrsistent-0.15.6-py37h7b6447c_0.conda
https://repo.anaconda.com/pkgs/main/noarch/python-dateutil-2.8.1-py_0.tar.bz2
https://repo.anaconda.com/pkgs/main/linux-64/setuptools-44.0.0-py37_0.conda
https://repo.anaconda.com/pkgs/main/linux-64/terminado-0.8.3-py37_0.conda
https://repo.anaconda.com/pkgs/main/linux-64/traitlets-4.3.3-py37_0.conda
https://repo.anaconda.com/pkgs/main/noarch/zipp-0.6.0-py_0.tar.bz2
https://repo.anaconda.com/pkgs/main/linux-64/bleach-3.1.0-py37_0.conda
https://repo.anaconda.com/pkgs/main/linux-64/importlib_metadata-1.3.0-py37_0.conda
https://repo.anaconda.com/pkgs/main/noarch/jinja2-2.10.3-py_0.tar.bz2
https://repo.anaconda.com/pkgs/main/linux-64/jupyter_core-4.6.1-py37_0.conda
https://repo.anaconda.com/pkgs/main/noarch/pygments-2.5.2-py_0.tar.bz2
https://repo.anaconda.com/pkgs/main/linux-64/wheel-0.33.6-py37_0.conda
https://repo.anaconda.com/pkgs/main/linux-64/jsonschema-3.2.0-py37_0.conda
https://repo.anaconda.com/pkgs/main/linux-64/jupyter_client-5.3.4-py37_0.conda
https://repo.anaconda.com/pkgs/main/linux-64/pip-19.3.1-py37_0.conda
https://repo.anaconda.com/pkgs/main/linux-64/prompt_toolkit-2.0.9-py37_0.conda
https://repo.anaconda.com/pkgs/main/linux-64/ipython-7.11.1-py37h39e3cac_0.conda
https://repo.anaconda.com/pkgs/main/linux-64/nbformat-4.4.0-py37_0.conda
https://repo.anaconda.com/pkgs/main/linux-64/ipykernel-5.1.3-py37h39e3cac_1.conda
https://repo.anaconda.com/pkgs/main/linux-64/nbconvert-5.6.1-py37_0.conda
https://repo.anaconda.com/pkgs/main/linux-64/jupyter_console-6.0.0-py37_0.conda
https://repo.anaconda.com/pkgs/main/linux-64/notebook-6.0.2-py37_0.conda
https://repo.anaconda.com/pkgs/main/noarch/qtconsole-4.6.0-py_1.conda
https://repo.anaconda.com/pkgs/main/linux-64/widgetsnbextension-3.5.1-py37_0.conda
https://repo.anaconda.com/pkgs/main/noarch/ipywidgets-7.5.1-py_0.tar.bz2
https://repo.anaconda.com/pkgs/main/linux-64/jupyter-1.0.0-py37_7.conda.utils.py3compat' (/home/pauljohn/LinuxDownloads/anaconda3/envs/fuzzymatch/lib/python3.7/site-packages/IPython/utils/py3compat.py)

這已從 jupyter 控制台 6.1.0 開始修復,可通過 conda 獲得。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM