How to use notebook in Ubuntu 22.04

How to use notebook in Ubuntu 22.04

  • Install
  • Start
  • Stop

Install

lwk@qwfys:~$ pip install notebook --upgrade -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
Collecting notebook
  Downloading http://mirrors.aliyun.com/pypi/packages/85/76/51777158391e1784cc5a892ff355fd0a0b0b5189aeffce9baf51f514b9a2/notebook-7.0.2-py3-none-any.whl (4.0 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.0/4.0 MB 1.2 MB/s eta 0:00:00
Requirement already satisfied: jupyter-server<3,>=2.4.0 in ./.local/lib/python3.10/site-packages (from notebook) (2.7.2)
Requirement already satisfied: jupyterlab-server<3,>=2.22.1 in ./.local/lib/python3.10/site-packages (from notebook) (2.24.0)
Requirement already satisfied: jupyterlab<5,>=4.0.2 in ./.local/lib/python3.10/site-packages (from notebook) (4.0.5)
Requirement already satisfied: notebook-shim<0.3,>=0.2 in ./.local/lib/python3.10/site-packages (from notebook) (0.2.3)
Requirement already satisfied: tornado>=6.2.0 in ./.local/lib/python3.10/site-packages (from notebook) (6.3.3)
Requirement already satisfied: anyio>=3.1.0 in ./.local/lib/python3.10/site-packages (from jupyter-server<3,>=2.4.0->notebook) (3.7.1)
Requirement already satisfied: argon2-cffi in ./.local/lib/python3.10/site-packages (from jupyter-server<3,>=2.4.0->notebook) (23.1.0)
Requirement already satisfied: jinja2 in ./.local/lib/python3.10/site-packages (from jupyter-server<3,>=2.4.0->notebook) (3.1.2)
Requirement already satisfied: jupyter-client>=7.4.4 in ./.local/lib/python3.10/site-packages (from jupyter-server<3,>=2.4.0->notebook) (8.3.0)
Requirement already satisfied: jupyter-core!=5.0.*,>=4.12 in ./.local/lib/python3.10/site-packages (from jupyter-server<3,>=2.4.0->notebook) (5.3.1)
Requirement already satisfied: jupyter-events>=0.6.0 in ./.local/lib/python3.10/site-packages (from jupyter-server<3,>=2.4.0->notebook) (0.7.0)
Requirement already satisfied: jupyter-server-terminals in ./.local/lib/python3.10/site-packages (from jupyter-server<3,>=2.4.0->notebook) (0.4.4)
Requirement already satisfied: nbconvert>=6.4.4 in ./.local/lib/python3.10/site-packages (from jupyter-server<3,>=2.4.0->notebook) (7.7.4)
Requirement already satisfied: nbformat>=5.3.0 in ./.local/lib/python3.10/site-packages (from jupyter-server<3,>=2.4.0->notebook) (5.9.2)
Requirement already satisfied: overrides in ./.local/lib/python3.10/site-packages (from jupyter-server<3,>=2.4.0->notebook) (7.4.0)
Requirement already satisfied: packaging in /usr/lib/python3/dist-packages (from jupyter-server<3,>=2.4.0->notebook) (21.3)
Requirement already satisfied: prometheus-client in ./.local/lib/python3.10/site-packages (from jupyter-server<3,>=2.4.0->notebook) (0.17.1)
Requirement already satisfied: pyzmq>=24 in ./.local/lib/python3.10/site-packages (from jupyter-server<3,>=2.4.0->notebook) (25.1.1)
Requirement already satisfied: send2trash>=1.8.2 in ./.local/lib/python3.10/site-packages (from jupyter-server<3,>=2.4.0->notebook) (1.8.2)
Requirement already satisfied: terminado>=0.8.3 in ./.local/lib/python3.10/site-packages (from jupyter-server<3,>=2.4.0->notebook) (0.17.1)
Requirement already satisfied: traitlets>=5.6.0 in ./.local/lib/python3.10/site-packages (from jupyter-server<3,>=2.4.0->notebook) (5.9.0)
Requirement already satisfied: websocket-client in ./.local/lib/python3.10/site-packages (from jupyter-server<3,>=2.4.0->notebook) (1.6.2)
Requirement already satisfied: async-lru>=1.0.0 in ./.local/lib/python3.10/site-packages (from jupyterlab<5,>=4.0.2->notebook) (2.0.4)
Requirement already satisfied: ipykernel in ./.local/lib/python3.10/site-packages (from jupyterlab<5,>=4.0.2->notebook) (6.25.1)
Requirement already satisfied: jupyter-lsp>=2.0.0 in ./.local/lib/python3.10/site-packages (from jupyterlab<5,>=4.0.2->notebook) (2.2.0)
Requirement already satisfied: tomli in ./.local/lib/python3.10/site-packages (from jupyterlab<5,>=4.0.2->notebook) (2.0.1)
Requirement already satisfied: babel>=2.10 in ./.local/lib/python3.10/site-packages (from jupyterlab-server<3,>=2.22.1->notebook) (2.12.1)
Requirement already satisfied: json5>=0.9.0 in ./.local/lib/python3.10/site-packages (from jupyterlab-server<3,>=2.22.1->notebook) (0.9.14)
Requirement already satisfied: jsonschema>=4.17.3 in ./.local/lib/python3.10/site-packages (from jupyterlab-server<3,>=2.22.1->notebook) (4.19.0)
Requirement already satisfied: requests>=2.28 in ./.local/lib/python3.10/site-packages (from jupyterlab-server<3,>=2.22.1->notebook) (2.31.0)
Requirement already satisfied: idna>=2.8 in /usr/lib/python3/dist-packages (from anyio>=3.1.0->jupyter-server<3,>=2.4.0->notebook) (3.3)
Requirement already satisfied: sniffio>=1.1 in ./.local/lib/python3.10/site-packages (from anyio>=3.1.0->jupyter-server<3,>=2.4.0->notebook) (1.3.0)
Requirement already satisfied: exceptiongroup in ./.local/lib/python3.10/site-packages (from anyio>=3.1.0->jupyter-server<3,>=2.4.0->notebook) (1.1.3)
Requirement already satisfied: typing-extensions>=4.0.0 in ./.local/lib/python3.10/site-packages (from async-lru>=1.0.0->jupyterlab<5,>=4.0.2->notebook) (4.7.1)
Requirement already satisfied: MarkupSafe>=2.0 in /usr/lib/python3/dist-packages (from jinja2->jupyter-server<3,>=2.4.0->notebook) (2.0.1)
Requirement already satisfied: attrs>=22.2.0 in ./.local/lib/python3.10/site-packages (from jsonschema>=4.17.3->jupyterlab-server<3,>=2.22.1->notebook) (23.1.0)
Requirement already satisfied: jsonschema-specifications>=2023.03.6 in ./.local/lib/python3.10/site-packages (from jsonschema>=4.17.3->jupyterlab-server<3,>=2.22.1->notebook) (2023.7.1)
Requirement already satisfied: referencing>=0.28.4 in ./.local/lib/python3.10/site-packages (from jsonschema>=4.17.3->jupyterlab-server<3,>=2.22.1->notebook) (0.30.2)
Requirement already satisfied: rpds-py>=0.7.1 in ./.local/lib/python3.10/site-packages (from jsonschema>=4.17.3->jupyterlab-server<3,>=2.22.1->notebook) (0.9.2)
Requirement already satisfied: python-dateutil>=2.8.2 in ./.local/lib/python3.10/site-packages (from jupyter-client>=7.4.4->jupyter-server<3,>=2.4.0->notebook) (2.8.2)
Requirement already satisfied: platformdirs>=2.5 in ./.local/lib/python3.10/site-packages (from jupyter-core!=5.0.*,>=4.12->jupyter-server<3,>=2.4.0->notebook) (3.10.0)
Requirement already satisfied: python-json-logger>=2.0.4 in ./.local/lib/python3.10/site-packages (from jupyter-events>=0.6.0->jupyter-server<3,>=2.4.0->notebook) (2.0.7)
Requirement already satisfied: pyyaml>=5.3 in /usr/lib/python3/dist-packages (from jupyter-events>=0.6.0->jupyter-server<3,>=2.4.0->notebook) (5.4.1)
Requirement already satisfied: rfc3339-validator in ./.local/lib/python3.10/site-packages (from jupyter-events>=0.6.0->jupyter-server<3,>=2.4.0->notebook) (0.1.4)
Requirement already satisfied: rfc3986-validator>=0.1.1 in ./.local/lib/python3.10/site-packages (from jupyter-events>=0.6.0->jupyter-server<3,>=2.4.0->notebook) (0.1.1)
Requirement already satisfied: beautifulsoup4 in /usr/lib/python3/dist-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->notebook) (4.10.0)
Requirement already satisfied: bleach!=5.0.0 in ./.local/lib/python3.10/site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->notebook) (6.0.0)
Requirement already satisfied: defusedxml in ./.local/lib/python3.10/site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->notebook) (0.7.1)
Requirement already satisfied: jupyterlab-pygments in ./.local/lib/python3.10/site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->notebook) (0.2.2)
Requirement already satisfied: mistune<4,>=2.0.3 in ./.local/lib/python3.10/site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->notebook) (3.0.1)
Requirement already satisfied: nbclient>=0.5.0 in ./.local/lib/python3.10/site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->notebook) (0.8.0)
Requirement already satisfied: pandocfilters>=1.4.1 in ./.local/lib/python3.10/site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->notebook) (1.5.0)
Requirement already satisfied: pygments>=2.4.1 in ./.local/lib/python3.10/site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->notebook) (2.16.1)
Requirement already satisfied: tinycss2 in /usr/lib/python3/dist-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->notebook) (1.1.1)
Requirement already satisfied: fastjsonschema in ./.local/lib/python3.10/site-packages (from nbformat>=5.3.0->jupyter-server<3,>=2.4.0->notebook) (2.18.0)
Requirement already satisfied: charset-normalizer<4,>=2 in ./.local/lib/python3.10/site-packages (from requests>=2.28->jupyterlab-server<3,>=2.22.1->notebook) (3.2.0)
Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/lib/python3/dist-packages (from requests>=2.28->jupyterlab-server<3,>=2.22.1->notebook) (1.26.5)
Requirement already satisfied: certifi>=2017.4.17 in /usr/lib/python3/dist-packages (from requests>=2.28->jupyterlab-server<3,>=2.22.1->notebook) (2020.6.20)
Requirement already satisfied: ptyprocess in /usr/lib/python3/dist-packages (from terminado>=0.8.3->jupyter-server<3,>=2.4.0->notebook) (0.7.0)
Requirement already satisfied: argon2-cffi-bindings in ./.local/lib/python3.10/site-packages (from argon2-cffi->jupyter-server<3,>=2.4.0->notebook) (21.2.0)
Requirement already satisfied: comm>=0.1.1 in ./.local/lib/python3.10/site-packages (from ipykernel->jupyterlab<5,>=4.0.2->notebook) (0.1.4)
Requirement already satisfied: debugpy>=1.6.5 in ./.local/lib/python3.10/site-packages (from ipykernel->jupyterlab<5,>=4.0.2->notebook) (1.6.7.post1)
Requirement already satisfied: ipython>=7.23.1 in ./.local/lib/python3.10/site-packages (from ipykernel->jupyterlab<5,>=4.0.2->notebook) (8.14.0)
Requirement already satisfied: matplotlib-inline>=0.1 in ./.local/lib/python3.10/site-packages (from ipykernel->jupyterlab<5,>=4.0.2->notebook) (0.1.6)
Requirement already satisfied: nest-asyncio in ./.local/lib/python3.10/site-packages (from ipykernel->jupyterlab<5,>=4.0.2->notebook) (1.5.7)
Requirement already satisfied: psutil in /usr/lib/python3/dist-packages (from ipykernel->jupyterlab<5,>=4.0.2->notebook) (5.9.0)
Requirement already satisfied: six>=1.9.0 in /usr/lib/python3/dist-packages (from bleach!=5.0.0->nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->notebook) (1.16.0)
Requirement already satisfied: webencodings in /usr/lib/python3/dist-packages (from bleach!=5.0.0->nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->notebook) (0.5.1)
Requirement already satisfied: backcall in ./.local/lib/python3.10/site-packages (from ipython>=7.23.1->ipykernel->jupyterlab<5,>=4.0.2->notebook) (0.2.0)
Requirement already satisfied: decorator in ./.local/lib/python3.10/site-packages (from ipython>=7.23.1->ipykernel->jupyterlab<5,>=4.0.2->notebook) (5.1.1)
Requirement already satisfied: jedi>=0.16 in ./.local/lib/python3.10/site-packages (from ipython>=7.23.1->ipykernel->jupyterlab<5,>=4.0.2->notebook) (0.19.0)
Requirement already satisfied: pickleshare in ./.local/lib/python3.10/site-packages (from ipython>=7.23.1->ipykernel->jupyterlab<5,>=4.0.2->notebook) (0.7.5)
Requirement already satisfied: prompt-toolkit!=3.0.37,<3.1.0,>=3.0.30 in ./.local/lib/python3.10/site-packages (from ipython>=7.23.1->ipykernel->jupyterlab<5,>=4.0.2->notebook) (3.0.39)
Requirement already satisfied: stack-data in ./.local/lib/python3.10/site-packages (from ipython>=7.23.1->ipykernel->jupyterlab<5,>=4.0.2->notebook) (0.6.2)
Requirement already satisfied: pexpect>4.3 in /usr/lib/python3/dist-packages (from ipython>=7.23.1->ipykernel->jupyterlab<5,>=4.0.2->notebook) (4.8.0)
Requirement already satisfied: fqdn in ./.local/lib/python3.10/site-packages (from jsonschema>=4.17.3->jupyterlab-server<3,>=2.22.1->notebook) (1.5.1)
Requirement already satisfied: isoduration in ./.local/lib/python3.10/site-packages (from jsonschema>=4.17.3->jupyterlab-server<3,>=2.22.1->notebook) (20.11.0)
Requirement already satisfied: jsonpointer>1.13 in ./.local/lib/python3.10/site-packages (from jsonschema>=4.17.3->jupyterlab-server<3,>=2.22.1->notebook) (2.4)
Requirement already satisfied: uri-template in ./.local/lib/python3.10/site-packages (from jsonschema>=4.17.3->jupyterlab-server<3,>=2.22.1->notebook) (1.3.0)
Requirement already satisfied: webcolors>=1.11 in ./.local/lib/python3.10/site-packages (from jsonschema>=4.17.3->jupyterlab-server<3,>=2.22.1->notebook) (1.13)
Requirement already satisfied: cffi>=1.0.1 in ./.local/lib/python3.10/site-packages (from argon2-cffi-bindings->argon2-cffi->jupyter-server<3,>=2.4.0->notebook) (1.15.1)
Requirement already satisfied: pycparser in ./.local/lib/python3.10/site-packages (from cffi>=1.0.1->argon2-cffi-bindings->argon2-cffi->jupyter-server<3,>=2.4.0->notebook) (2.21)
Requirement already satisfied: parso<0.9.0,>=0.8.3 in ./.local/lib/python3.10/site-packages (from jedi>=0.16->ipython>=7.23.1->ipykernel->jupyterlab<5,>=4.0.2->notebook) (0.8.3)
Requirement already satisfied: wcwidth in ./.local/lib/python3.10/site-packages (from prompt-toolkit!=3.0.37,<3.1.0,>=3.0.30->ipython>=7.23.1->ipykernel->jupyterlab<5,>=4.0.2->notebook) (0.2.6)
Requirement already satisfied: arrow>=0.15.0 in ./.local/lib/python3.10/site-packages (from isoduration->jsonschema>=4.17.3->jupyterlab-server<3,>=2.22.1->notebook) (1.2.3)
Requirement already satisfied: executing>=1.2.0 in ./.local/lib/python3.10/site-packages (from stack-data->ipython>=7.23.1->ipykernel->jupyterlab<5,>=4.0.2->notebook) (1.2.0)
Requirement already satisfied: asttokens>=2.1.0 in ./.local/lib/python3.10/site-packages (from stack-data->ipython>=7.23.1->ipykernel->jupyterlab<5,>=4.0.2->notebook) (2.2.1)
Requirement already satisfied: pure-eval in ./.local/lib/python3.10/site-packages (from stack-data->ipython>=7.23.1->ipykernel->jupyterlab<5,>=4.0.2->notebook) (0.2.2)
Installing collected packages: notebook
Successfully installed notebook-7.0.2
lwk@qwfys:~$

Start

lwk@qwfys:~$ jupyter notebook
[I 2023-08-27 15:20:50.940 ServerApp] Package notebook took 0.0000s to import
[I 2023-08-27 15:20:50.948 ServerApp] Package jupyter_lsp took 0.0076s to import
[W 2023-08-27 15:20:50.948 ServerApp] A `_jupyter_server_extension_points` function was not found in jupyter_lsp. Instead, a `_jupyter_server_extension_paths` function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.
[I 2023-08-27 15:20:50.952 ServerApp] Package jupyter_server_terminals took 0.0037s to import
[I 2023-08-27 15:20:50.953 ServerApp] Package jupyterlab took 0.0000s to import
[I 2023-08-27 15:20:51.266 ServerApp] Package notebook_shim took 0.0000s to import
[W 2023-08-27 15:20:51.267 ServerApp] A `_jupyter_server_extension_points` function was not found in notebook_shim. Instead, a `_jupyter_server_extension_paths` function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.
[I 2023-08-27 15:20:51.267 ServerApp] jupyter_lsp | extension was successfully linked.
[I 2023-08-27 15:20:51.270 ServerApp] jupyter_server_terminals | extension was successfully linked.
[I 2023-08-27 15:20:51.274 ServerApp] jupyterlab | extension was successfully linked.
[I 2023-08-27 15:20:51.278 ServerApp] notebook | extension was successfully linked.
[I 2023-08-27 15:20:51.450 ServerApp] notebook_shim | extension was successfully linked.
[I 2023-08-27 15:20:51.461 ServerApp] notebook_shim | extension was successfully loaded.
[I 2023-08-27 15:20:51.464 ServerApp] jupyter_lsp | extension was successfully loaded.
[I 2023-08-27 15:20:51.465 ServerApp] jupyter_server_terminals | extension was successfully loaded.
[I 2023-08-27 15:20:51.467 LabApp] JupyterLab extension loaded from /home/lwk/.local/lib/python3.10/site-packages/jupyterlab
[I 2023-08-27 15:20:51.467 LabApp] JupyterLab application directory is /home/lwk/.local/share/jupyter/lab
[I 2023-08-27 15:20:51.467 LabApp] Extension Manager is 'pypi'.
[I 2023-08-27 15:20:51.469 ServerApp] jupyterlab | extension was successfully loaded.
[I 2023-08-27 15:20:51.471 ServerApp] notebook | extension was successfully loaded.
[I 2023-08-27 15:20:51.472 ServerApp] Serving notebooks from local directory: /home/lwk
[I 2023-08-27 15:20:51.472 ServerApp] Jupyter Server 2.7.2 is running at:
[I 2023-08-27 15:20:51.472 ServerApp] http://localhost:8888/tree?token=9cf4b322bb1935233acf0a98e8a1cf75219aaddba222cb49
[I 2023-08-27 15:20:51.472 ServerApp]     http://127.0.0.1:8888/tree?token=9cf4b322bb1935233acf0a98e8a1cf75219aaddba222cb49
[I 2023-08-27 15:20:51.472 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 2023-08-27 15:20:51.488 ServerApp] 
    
    To access the server, open this file in a browser:
        file:///home/lwk/.local/share/jupyter/runtime/jpserver-16183-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/tree?token=9cf4b322bb1935233acf0a98e8a1cf75219aaddba222cb49
        http://127.0.0.1:8888/tree?token=9cf4b322bb1935233acf0a98e8a1cf75219aaddba222cb49
[I 2023-08-27 15:20:51.765 ServerApp] Skipped non-installed server(s): bash-language-server, dockerfile-language-server-nodejs, javascript-typescript-langserver, jedi-language-server, julia-language-server, pyright, python-language-server, python-lsp-server, r-languageserver, sql-language-server, texlab, typescript-language-server, unified-language-server, vscode-css-languageserver-bin, vscode-html-languageserver-bin, vscode-json-languageserver-bin, yaml-language-server

这个时候,系统会自动打开浏览器,浏览器会自动跳转到页面http://localhost:8888/tree,如下图所示:

How to use notebook in Ubuntu 22.04_第1张图片

How to use notebook in Ubuntu 22.04_第2张图片

How to use notebook in Ubuntu 22.04_第3张图片

How to use notebook in Ubuntu 22.04_第4张图片
How to use notebook in Ubuntu 22.04_第5张图片

How to use notebook in Ubuntu 22.04_第6张图片

How to use notebook in Ubuntu 22.04_第7张图片
How to use notebook in Ubuntu 22.04_第8张图片

How to use notebook in Ubuntu 22.04_第9张图片

How to use notebook in Ubuntu 22.04_第10张图片
How to use notebook in Ubuntu 22.04_第11张图片

How to use notebook in Ubuntu 22.04_第12张图片
How to use notebook in Ubuntu 22.04_第13张图片
How to use notebook in Ubuntu 22.04_第14张图片

How to use notebook in Ubuntu 22.04_第15张图片
How to use notebook in Ubuntu 22.04_第16张图片
How to use notebook in Ubuntu 22.04_第17张图片

How to use notebook in Ubuntu 22.04_第18张图片
How to use notebook in Ubuntu 22.04_第19张图片

How to use notebook in Ubuntu 22.04_第20张图片

How to use notebook in Ubuntu 22.04_第21张图片

How to use notebook in Ubuntu 22.04_第22张图片
How to use notebook in Ubuntu 22.04_第23张图片
How to use notebook in Ubuntu 22.04_第24张图片
How to use notebook in Ubuntu 22.04_第25张图片

Stop

如果我们希望停止服务运行,可以在终端窗口中按Ctrl+C,这个时候,终端窗口命令行会出现如下变化

^C[I 2023-08-27 15:24:53.324 ServerApp] interrupted
[I 2023-08-27 15:24:53.324 ServerApp] Serving notebooks from local directory: /home/lwk
    0 active kernels
    Jupyter Server 2.7.2 is running at:
    http://localhost:8888/tree?token=9cf4b322bb1935233acf0a98e8a1cf75219aaddba222cb49
        http://127.0.0.1:8888/tree?token=9cf4b322bb1935233acf0a98e8a1cf75219aaddba222cb49
Shutdown this Jupyter server (y/[n])? y
[C 2023-08-27 15:24:57.241 ServerApp] Shutdown confirmed
[I 2023-08-27 15:24:57.243 ServerApp] Shutting down 5 extensions
lwk@qwfys:~$ 

我们再来观察notebook浏览器画面,发现没有任何变化。

你可能感兴趣的:(Programming,notebook,Ubuntu,use,How)