Jupyter Lab したい(jupyter lab)
// jupyter-core から jupyter コマンドを読み込んで実行
$ uvx --from jupyter-core jupyter --version
Selected Jupyter core packages...
IPython : not installed
ipykernel : not installed
ipywidgets : not installed
jupyter_client : not installed
jupyter_core : 5.9.1
jupyter_server : not installed
jupyterlab : not installed
nbclient : not installed
nbconvert : not installed
nbformat : not installed
notebook : not installed
qtconsole : not installed
traitlets : 5.14.3
// Jupyter Labを起動
$ uvx --from jupyter-core jupyter lab
jupyter labコマンドでJupyter Labを起動できます。
注釈
jupyter自体はCLIパッケージではありません。
uvxを使って、隔離環境で実行する場合は--from jupyter-coreを指定し、
jupyter-coreパッケージからjupyterコマンドを読み込んで実行する必要があります。
インストールしたい(jupyterlab / jupyter-core)
uvでインストール
$ uv tool install jupyterlab
Jupyter関係のツールはサブパッケージに別れていますが、
uv tool installする場合jupyterlabパッケージを指定すればよさそうです。
uvxで一時的にインストール
$ uvx --from jupyter-core jupyter lab
uvxで一時的にjupyter labを実行する場合は、
jupyter-coreからjupyterコマンドをインストールします。
pipxでインストール
$ pipx install jupyter --include-deps
pipxの場合、--include-depsで関連パッケージをすべてインストールできます。
拡張機能したい(labextension)
// インストール済みの拡張機能を確認
$ jupyter labextension list
JupyterLab v4.2.5
~/.local/share/uv/tools/jupyterlab/share/jupyter/labextensions
jupyterlab_pygments v0.3.0 enabled OK (python, jupyterlab_pygments)
// 拡張機能のインストール
$ jupyter labextension install 拡張パッケージ名
// 拡張機能のアンインストール
$ jupyter labextension uninstall 拡張パッケージ名
labextentionコマンドで、Jupyter Labの拡張機能を操作できます。
注意
(Deprecated) Uninstalling extensions with the jupyter labextension uninstall command is now deprecated and will be removed in a future major version of JupyterLab.
Users should manage prebuilt extensions with package managers like pip and conda, and extension authors are encouraged to distribute their extensions as prebuilt packages
labextensionコマンドでインストール、アンインストールする方法は非推奨だそうです。
$ jupyter labextension install @jupyterlab/extensionmanager
@jupyterlab/extensionmanagerをインストールすると、
Jupyter LabのサイドバーにExtension Managerのタブが追加され、
GUIを使って拡張機能を追加できるようになります。
キーバインド拡張したい
// VS Code-likeなキーマップ
$ jupyter labextension install @jupyterlab/vscode-keymap
// Vim-likeなキーマップ
$ jupyter labextension install @axlair/jupyterlab_vim
// Emacs-likeなキーマップ
$ jupyter labextension install @jupyterlab/emacs-keymap
VS Codeしたい
$ uv pip install ipykernel
Jupyter Extension for VS Codeと
ipykernelをインストールすると、VS CodeでJupyter Labできます。