`jupyter notebook`给出错误:`“无法在macOS上打开静态文件”“`

时间:2019-09-08 16:23:40

标签: jupyter-notebook upgrade conda

我尚未更改系统配置,但今天是我第一次发现此错误。

我在这里报告过:https://github.com/jupyter/notebook/issues/4871

> jupyter notebook
[I 10:44:20.102 NotebookApp] JupyterLab extension loaded from /usr/local/anaconda3/lib/python3.7/site-packages/jupyterlab
[I 10:44:20.102 NotebookApp] JupyterLab application directory is /usr/local/anaconda3/share/jupyter/lab
[I 10:44:20.104 NotebookApp] Serving notebooks from local directory: /Users/pi
[I 10:44:20.104 NotebookApp] The Jupyter Notebook is running at:
[I 10:44:20.104 NotebookApp] http://localhost:8888/?token=586797fb9049c0faea24f2583c4de32c08d45c89051fb07d
[I 10:44:20.104 NotebookApp]  or http://127.0.0.1:8888/?token=586797fb9049c0faea24f2583c4de32c08d45c89051fb07d
[I 10:44:20.104 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 10:44:20.110 NotebookApp]

    To access the notebook, open this file in a browser:
        file:///Users/pi/Library/Jupyter/runtime/nbserver-65385-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/?token=586797fb9049c0faea24f2583c4de32c08d45c89051fb07d
     or http://127.0.0.1:8888/?token=586797fb9049c0faea24f2583c4de32c08d45c89051fb07d
[E 10:44:21.457 NotebookApp] Could not open static file ''
[W 10:44:21.512 NotebookApp] 404 GET /static/components/react/react-dom.production.min.js (::1) 9.02ms referer=http://localhost:8888/tree?token=BLA
[W 10:44:21.548 NotebookApp] 404 GET /static/components/react/react-dom.production.min.js (::1) 0.99ms referer=http://localhost:8888/tree?token=BLA
Set

此问题似乎已在Jupyter 6.0.1

中修复

问题就变成了:我可以强制安装jupyter 6.0.1吗?

由于最初的问题现在引起了第二个问题,所以我现在在这里问这个新问题:How to force `conda` to install the latest version of `jupyter`?

或者,我可以手动提供丢失的文件,但不确定位置。我在这里问过:Where does Jupyter install site-packages on macOS?

研究:

https://github.com/jupyter/notebook/pull/4772 “在2019年8月6日将缺少的react-dom js添加到打包数据#4772中”

  

minrk在7月18日将其添加到6.0.1里程碑

好吧,我可以得到Jupyter Notebook 6.0.1吗?

brew cask install anaconda下载7月份的~/Library/Caches/Homebrew/downloads/{LONG HEX}--Anaconda3-2019.07-MacOSX-x86_64,并且conda --version报告conda 4.7.10。但这是针对Anaconda的,它是软件包 Manager

> conda list | grep jupy
jupyter                   1.0.0                    py37_7
jupyter_client            5.3.1                      py_0
jupyter_console           6.0.0                    py37_0
jupyter_core              4.5.0                      py_0
jupyterlab                1.0.2            py37hf63ae98_0
jupyterlab_server         1.0.0                      py_0

这有点令人困惑。这里没有jupyter notebook

> which jupyter
/usr/local/anaconda3/bin/jupyter

> jupyter --version
jupyter core     : 4.5.0
jupyter-notebook : 6.0.0
qtconsole        : 4.5.1
ipython          : 7.6.1
ipykernel        : 5.1.1
jupyter client   : 5.3.1
jupyter lab      : 1.0.2
nbconvert        : 5.5.0
ipywidgets       : 7.5.0
nbformat         : 4.4.0
traitlets        : 4.3.2

好吧,所以jupyter-notebookjupyter中,该位置由Anaconda维护。

我们可以更新吗?

https://jupyter.readthedocs.io/en/latest/projects/upgrade-notebook.html

> conda update jupyter
 :

las jupyter --version仍然是6.0.0

2 个答案:

答案 0 :(得分:2)

我通过更新pip和pip3上的jupyter来解决此问题(为安全起见)

同时使用

pip install --upgrade jupyter

pip3 install --upgrade jupyter --no-cache-dir

我相信您可以在终端以及conda的终端中执行此操作(因为conda envs也具有pip)

答案 1 :(得分:0)

根据Where does Jupyter install site-packages on macOS?,我找到系统jupyter上正在搜索此丢失文件的位置:

> find / -path '*/static/components'  2>/dev/null
/usr/local/anaconda3/pkgs/notebook-6.0.0-py37_0/lib/python3.7/site-packages/notebook/static/components
/usr/local/anaconda3/lib/python3.7/site-packages/notebook/static/components

根据https://github.com/jupyter/notebook/pull/4772#issuecomment-515794823,如果我下载该文件并将其存放在第二个位置,即创建:

/usr/local/anaconda3/lib/python3.7/site-packages/notebook/static/components/react/react-dom.production.min.js

...现在jupyter notebook正常启动。

注意:谨慎,我也将其复制到了第一个位置。但这似乎没有任何作用。