jupyter lab 初探以及配置

2020/7/24 jupyter

# jupyter lab 安装

jupyter 直接使用

conda install -c conda-forge jupyterlab
1

新建一个环境安装即可

# 配置

jupyter lab --generate-config
1

将生成配置文件: $HOME/.jupyter/jupyter_notebook_config.py

随后修改其中关于远程设置的选项

c.LabApp.ip = '*'
c.NotebookApp.allow_remote_access = True
c.LabApp.password = 'argon2:$argon2id$v=19$m=10240,t=10,p=8$92rB**********PYsvR0Xg$E3pgnns/A3RuN7v/d9zgWw'
1
2
3

其中 password 可通过

from notebook.auth import passwd
passwd()
1
2

获取

# 启动

jupyter lab
1

具体参数请参见官网文档

此外也可以通过本地 ssh 映射登陆(主要是为了内网穿透,不知道为什么,组里的服务器挂载路由器后面,就无法访问了)

通过访问端

ssh -N -f -L localhost:8888:localhost:8888 user@ip -p 120
1

完成端口映射以后,即可在浏览器里面通过 127.0.0.1:8888 访问

# 插件安装

# 插件管理器

conda install -c nodejs
jupyter labextension install @jupyter-widgets/jupyterlab-manager
# If you already installed the @jupyter-widgets/jupyterlab-manager extension, you will still need to rebuild JupyterLab after you installed ipympl
jupyter lab build
1
2
3
4

# 中文界面

conda install -c conda-forge jupyterlab-language-pack-zh-CN
1

# matplotlib

Github 地址 (opens new window)

利用 Jupyter 交互式小部件框架,在 Jupyter 笔记本和 JupyterLab 中实现 matplotlib 的交互式功能

安装

conda install ipympl
1

# jupyterlab_variableinspector

Github 地址 (opens new window)

Jupyterlab 扩展,显示当前使用的变量及其值。

安装

jupyter labextension install @lckr/jupyterlab_variableinspector
1

# jupyterlab-drawio

Github 地址 (opens new window)

Jupyterlab 扩展, 用于将 drawio / mxgraph 独立集成到 Jupyterlab 中。

安装

jupyter labextension install jupyterlab-drawio
1

# jupyterlab-lsp

Github 地址 (opens new window)

Jupyter 的语言服务器协议集成

安装

pip install jupyter-lsp
pip install 'python-language-server[all]'
jupyter labextension install @krassowski/jupyterlab-lsp
1
2
3

# xeus-cling

Github 地址 (opens new window)

xeus-cling 是一个 Jupyter 内核。

安装

conda install xeus-cling -c conda-forge
1
pip install https://jfds-1252952517.cos.ap-chengdu.myqcloud.com/jupyterhub/jupyterlab_language_pack_zh_CN-0.0.1.dev0-py2.py3-none-any.whl
1

# kepler.gl

Github 地址 (opens new window)

一个先进的地理空间可视化工具,用于在 Jupyter 笔记本中呈现大规模交互式地图。

安装

pip install keplergl
jupyter labextension install keplergl-jupyter
1
2

Last Updated: 2023-10-29T08:26:04.000Z