目次
pipx - 分離環境での Python アプリケーションのインストールと実行
インストール
公式: Install pipx - Installation - pipx 翻訳
Fedora
$ python3 -m pip install --user pipx
Collecting pipx Downloading pipx-1.2.0-py3-none-any.whl (57 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 57.8/57.8 kB 318.0 kB/s eta 0:00:00 Requirement already satisfied: argcomplete>=1.9.4 in /usr/lib/python3.11/site-packages (from pipx) (2.0.0) Requirement already satisfied: packaging>=20.0 in /usr/lib/python3.11/site-packages (from pipx) (23.0) Collecting userpath>=1.6.0 Downloading userpath-1.9.0-py3-none-any.whl (9.0 kB) Requirement already satisfied: click in /usr/lib/python3.11/site-packages (from userpath>=1.6.0->pipx) (8.1.3) Installing collected packages: userpath, pipx WARNING: The script userpath is installed in '/home/tomoyan/.local/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. WARNING: The script pipx is installed in '/home/tomoyan/.local/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. Successfully installed pipx-1.2.0 userpath-1.9.0
Windows
$ python3 -m pip install --user pipx
Collecting pipx Downloading pipx-1.2.0-py3-none-any.whl (57 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 57.8/57.8 kB 610.0 kB/s eta 0:00:00 Collecting argcomplete>=1.9.4 (from pipx) Obtaining dependency information for argcomplete>=1.9.4 from https://files.pythonhosted.org/packages/4f/ef/8b604222ba5e5190e25851aa3a5b754f2002361dc62a258a8e9f13e866f4/argcomplete-3.1.1-py3-none-any.whl.metadata Downloading argcomplete-3.1.1-py3-none-any.whl.metadata (16 kB) Collecting colorama>=0.4.4 (from pipx) Downloading colorama-0.4.6-py2.py3-none-any.whl (25 kB) Collecting packaging>=20.0 (from pipx) Downloading packaging-23.1-py3-none-any.whl (48 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 822.7 kB/s eta 0:00:00 Collecting userpath>=1.6.0 (from pipx) Obtaining dependency information for userpath>=1.6.0 from https://files.pythonhosted.org/packages/54/e4/5a33b7d5d2a7387ad7d5cf11cab2b832fd36ace778597e365595c5a12041/userpath-1.9.0-py3-none-any.whl.metadata Downloading userpath-1.9.0-py3-none-any.whl.metadata (3.0 kB) Collecting click (from userpath>=1.6.0->pipx) Obtaining dependency information for click from https://files.pythonhosted.org/packages/1a/70/e63223f8116931d365993d4a6b7ef653a4d920b41d03de7c59499962821f/click-8.1.6-py3-none-any.whl.metadata Downloading click-8.1.6-py3-none-any.whl.metadata (3.0 kB) Downloading argcomplete-3.1.1-py3-none-any.whl (41 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 41.5/41.5 kB 504.0 kB/s eta 0:00:00 Downloading userpath-1.9.0-py3-none-any.whl (9.0 kB) Downloading click-8.1.6-py3-none-any.whl (97 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 97.9/97.9 kB 942.7 kB/s eta 0:00:00 Installing collected packages: packaging, colorama, argcomplete, click, userpath, pipx Successfully installed argcomplete-3.1.1 click-8.1.6 colorama-0.4.6 packaging-23.1 pipx-1.2.0 userpath-1.9.0
PATH 環境変数の設定
$ python3 -m pipx ensurepath
Success! Added /home/tomoyan/.local/bin to the PATH environment variable. Consider adding shell completions for pipx. Run 'pipx completions' for instructions. You will need to open a new terminal or re-login for the PATH changes to take effect. Otherwise pipx is ready to go! ✨ 🌟 ✨
成功! PATH 環境変数に /home/tomoyan/.local/bin を追加しました。 pipx のシェル補完を追加することを検討してください。手順については「pipx completed」を実行してください。 PATH の変更を有効にするには、新しいターミナルを開くか、再ログインする必要があります。 それ以外の場合は、pipx を使用する準備ができています。 ✨ 🌟 ✨
zsh の場合は ~/.zprofile
に PATH
の設定が追加されます。
┌──(tomoyan WICKED-BEAT)-[~] └─$ cat ~/.zprofile
# Created by `pipx` on 2023-07-23 04:47:06 export PATH="$PATH:/home/tomoyan/.local/bin"
bash の場合は…🤔
~/.profile
が優先なディストリビューションでは、それに PATH
の設定が追加されます。
$ cat ~/.profile
# Created by `pipx` on 2023-08-03 21:57:19 export PATH="$PATH:/home/dietpi/.local/bin"
~/.bash_profile
に PATH
の設定が追加されます。
$ cat ~/.bash_profile
# Created by `pipx` on 2023-07-23 05:54:36 export PATH="$PATH:/home/tomoyan/.local/bin"
$ ls -al
... -rw-r--r-- 1 dietpi dietpi 161 Dec 16 00:24 .profile
~/.bash_profile ではなく ~/.profile に統一しているディストリビューションでは、~/.bash_profile が存在していないので ~/.profile に設定を追記するべきです。新たに ~/.bash_profile を作成してしまうと元々の ~/.profile が実行されなくなって問題が起きる可能性があります😱
ログイン時のスクリプト実行優先順位は、以下の順番で且つ何れか1つだけが実行されます🤔
~/.bash_profile ~/.bash_login ~/.profile
参考: 【LPIC102】bashの設定ファイルと読み込み順序 LPICで学ぶLinux2 - SEワンタンの独学備忘録
設定の反映
シェルの設定を反映させる。(exec $(which zsh) –login
or exec $(which bash) –login
…)
$ exec $SHELL -l $ pipx --version
1.2.0
$ ls -al .bash*
... -rw-r--r-- 1 tomoyan tomoyan 187 2月 9 04:11 .bash_profile -rw-r--r-- 1 tomoyan tomoyan 575 2月 8 14:00 .bashrc
.bash_profile
または .profile
は、ログイン時に1度だけ実行される🤔
.bashrc
は、bash 起動時に1度だけ実行される🤔
※exec $SHELL -l
は .bash_profile を適用して bash を起動するが、その bash を終了すると .bash_profile の内容は失われるので再ログインする必要がある🤔
更新
コマンド補完
公式: Shell Completion - Installation - pipx 翻訳
Fedora
$ python3 -m pipx completions
Add the appropriate command to your shell's config file so that it is run on startup. You will likely have to restart or re-login for the autocompletion to start working. bash: eval "$(register-python-argcomplete pipx)" zsh: To activate completions for zsh you need to have bashcompinit enabled in zsh: autoload -U bashcompinit bashcompinit Afterwards you can enable completion for pipx: eval "$(register-python-argcomplete pipx)" tcsh: eval `register-python-argcomplete --shell tcsh pipx` fish: # Not required to be in the config file, only run once register-python-argcomplete --shell fish pipx >~/.config/fish/completions/pipx.fish
適切なコマンドをシェルの構成ファイルに追加します。 起動時に実行されるようにします。おそらく再起動が必要になるでしょう または、オートコンプリートを機能させるために再ログインしてください。 bash: eval "$(register-python-argcomplete pipx)" zsh: zsh の補完を有効にするには、次のものが必要です。 zsh で bashcompinit を有効にします。 autoload -U bashcompinit bashcompinit その後、pipx の補完を有効にできます。 eval "$(register-python-argcomplete pipx)" tcsh: eval `register-python-argcomplete --shell tcsh pipx` fish: # 構成ファイルに含める必要はなく、一度だけ実行します register-python-argcomplete --shellfish pipx >~/.config/fish/completions/pipx.fish
zsh の場合
┌──(tomoyan WICKED-BEAT)-[~] └─$ echo 'autoload bashcompinit && bashcompinit' >> ~/.zprofile$ echo 'eval "$(register-python-argcomplete pipx)"' >> ~/.zprofile $ . ~/.zprofile $ pipx -> Tab キーを押す completions -- Print instructions on enabling shell completions for pipx ensurepath -- Ensure directories necessary for pipx operation are in your PATH environment variable. environment -- Print a list of variables used in pipx.constants. --help -h -- show this help message and exit inject -- Install packages into an existing Virtual Environment install -- Install a package list -- List installed packages reinstall -- Reinstall a package reinstall-all -- Reinstall all packages run -- Download the latest version of a package to a temporary virtual environment, then run runpip -- Run pip in an existing pipx-managed Virtual Environment uninject -- Uninstall injected packages from an existing Virtual Environment uninstall -- Uninstall a package uninstall-all -- Uninstall all packages upgrade -- Upgrade a package upgrade-all -- Upgrade all packages. Runs `pip install -U <pkgname>` for each package. --version -- Print version and exit
bash の場合
$ echo 'eval "$(register-python-argcomplete pipx)"' >> ~/.bash_profile $ . ~/.bash_profile $ pipx -> Tab キーを押す --help completions inject reinstall runpip uninstall-all --version ensurepath install reinstall-all uninject upgrade -h environment list run uninstall upgrade-all
使い方 [--help]
$ pipx --help
usage: pipx [-h] [--version] {install,uninject,inject,upgrade,upgrade-all,uninstall,uninstall-all,reinstall,reinstall-all,list,run,runpip,ensurepath,environment,completions} ... Install and execute apps from Python packages. Binaries can either be installed globally into isolated Virtual Environments or run directly in a temporary Virtual Environment. Virtual Environment location is /home/tomoyan/.local/pipx/venvs. Symlinks to apps are placed in /home/tomoyan/.local/bin. optional environment variables: PIPX_HOME Overrides default pipx location. Virtual Environments will be installed to $PIPX_HOME/venvs. PIPX_BIN_DIR Overrides location of app installations. Apps are symlinked or copied here. PIPX_DEFAULT_PYTHON Overrides default python used for commands. USE_EMOJI Overrides emoji behavior. Default value varies based on platform. options: -h, --help show this help message and exit --version Print version and exit subcommands: Get help for commands with pipx COMMAND --help {install,uninject,inject,upgrade,upgrade-all,uninstall,uninstall-all,reinstall,reinstall-all,list,run,runpip,ensurepath,environment,completions} install Install a package uninject Uninstall injected packages from an existing Virtual Environment inject Install packages into an existing Virtual Environment upgrade Upgrade a package upgrade-all Upgrade all packages. Runs `pip install -U <pkgname>` for each package. uninstall Uninstall a package uninstall-all Uninstall all packages reinstall Reinstall a package reinstall-all Reinstall all packages list List installed packages run Download the latest version of a package to a temporary virtual environment, then run an app from it. Also compatible with local `__pypackages__` directory (experimental). runpip Run pip in an existing pipx-managed Virtual Environment ensurepath Ensure directories necessary for pipx operation are in your PATH environment variable. environment Print a list of variables used in pipx.constants. completions Print instructions on enabling shell completions for pipx
install
$ pipx install --help
usage: pipx install [-h] [--include-deps] [--verbose] [--force] [--suffix SUFFIX] [--python PYTHON] [--system-site-packages] [--index-url INDEX_URL] [--editable] [--pip-args PIP_ARGS] package_spec The install command is the preferred way to globally install apps from python packages on your system. It creates an isolated virtual environment for the package, then ensures the package's apps are accessible on your $PATH. The result: apps you can run from anywhere, located in packages you can cleanly upgrade or uninstall. Guaranteed to not have dependency version conflicts or interfere with your OS's python packages. 'sudo' is not required to do this. pipx install PACKAGE_NAME pipx install --python PYTHON PACKAGE_NAME pipx install VCS_URL pipx install ./LOCAL_PATH pipx install ZIP_FILE pipx install TAR_GZ_FILE The PACKAGE_SPEC argument is passed directly to `pip install`. The default virtual environment location is C:\Users\tomoyan\.local\pipx and can be overridden by setting the environment variable `PIPX_HOME` (Virtual Environments will be installed to `$PIPX_HOME/venvs`). The default app location is C:\Users\tomoyan\.local\bin and can be overridden by setting the environment variable `PIPX_BIN_DIR`. The default python executable used to install a package is C:\Users\tomoyan\scoop\apps\python\current\python.exe and can be overridden by setting the environment variable `PIPX_DEFAULT_PYTHON`. positional arguments: package_spec package name or pip installation spec options: -h, --help show this help message and exit --include-deps Include apps of dependent packages --verbose --force, -f Modify existing virtual environment and files in PIPX_BIN_DIR --suffix SUFFIX Optional suffix for virtual environment and executable names. NOTE: The suffix feature is experimental and subject to change. --python PYTHON The Python executable used to create the Virtual Environment and run the associated app/apps. Must be v3.6+. --system-site-packages Give the virtual environment access to the system site-packages dir. --index-url INDEX_URL, -i INDEX_URL Base URL of Python Package Index --editable, -e Install a project in editable mode --pip-args PIP_ARGS Arbitrary pip arguments to pass directly to pip install/upgrade commands
inject
$ pipx inject --help
usage: pipx inject [-h] [--include-apps] [--include-deps] [--system-site-packages] [--index-url INDEX_URL] [--editable] [--pip-args PIP_ARGS] [--force] [--verbose] package dependencies [dependencies ...] Installs packages to an existing pipx-managed virtual environment. positional arguments: package Name of the existing pipx-managed Virtual Environment to inject into dependencies the packages to inject into the Virtual Environment--either package name or pip package spec options: -h, --help show this help message and exit --include-apps Add apps from the injected packages onto your PATH --include-deps Include apps of dependent packages --system-site-packages Give the virtual environment access to the system site-packages dir. --index-url INDEX_URL, -i INDEX_URL Base URL of Python Package Index --editable, -e Install a project in editable mode --pip-args PIP_ARGS Arbitrary pip arguments to pass directly to pip install/upgrade commands --force, -f Modify existing virtual environment and files in PIPX_BIN_DIR --verbose
JupyterLab 複数バージョンの混在
JupyterLab3 基本セット
$ pipx install --suffix 3 jupyterlab==3.6.5
installed package jupyterlab 3.6.5 (jupyterlab3), installed using Python 3.11.4 These apps are now globally available - jlpm3.exe - jupyter-lab3.exe - jupyter-labextension3.exe - jupyter-labhub3.exe done! ✨ 🌟 ✨
$ pipx inject jupyterlab3 jupyterlab-language-pack-ja-JP jupyterlab-git
injected package jupyterlab-language-pack-ja-jp into venv jupyterlab3 done! ✨ 🌟 ✨ injected package jupyterlab-git into venv jupyterlab3 done! ✨ 🌟 ✨
JupyterLab4 基本セット
$ pipx install --suffix 4 jupyterlab==4.0.6
installed package jupyterlab 4.0.6 (jupyterlab4), installed using Python 3.11.4 These apps are now globally available - jlpm4.exe - jupyter-lab4.exe - jupyter-labextension4.exe - jupyter-labhub4.exe done! ✨ 🌟 ✨
$ pipx inject jupyterlab4 jupyterlab-language-pack-ja-JP jupyterlab-git
injected package jupyterlab-language-pack-ja-jp into venv jupyterlab4 done! ✨ 🌟 ✨ injected package jupyterlab-git into venv jupyterlab4 done! ✨ 🌟 ✨
jupyterlab-drawio
$ pipx inject jupyterlab4 jupyterlab-drawio
injected package jupyterlab-drawio into venv jupyterlab4 done! ✨ 🌟 ✨
jupyterlab-lsp
Jupyter[Lab] Language Server Protocol — Jupyter[Lab] Language Server documentation 翻訳
jupyter-lsp/jupyterlab-lsp: Coding assistance for JupyterLab (code navigation + hover suggestions + linters + autocompletion + rename) using Language Server Protocol 翻訳
python-lsp/python-lsp-server: Fork of the python-language-server project, maintained by the Spyder IDE team and the community 翻訳
Installation — Jupyter[Lab] Language Server documentation 翻訳
jupyter-lsp
は notebook 用で、jupyterlab-lsp
は JupyterLab 用の拡張機能である。
$ pipx inject jupyterlab4 jupyterlab-lsp
injected package jupyterlab-lsp into venv jupyterlab4 done! ✨ 🌟 ✨
$ jlpm4 add --dev \ bash-language-server \ dockerfile-language-server-nodejs \ javascript-typescript-langserver \ sql-language-server \ unified-language-server \ vscode-css-languageserver-bin \ vscode-html-languageserver-bin \ vscode-json-languageserver-bin \ yaml-language-server
yarn add v1.21.1 warning package.json: No license field warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json. warning No license field [1/4] Resolving packages... warning javascript-typescript-langserver > string-similarity@2.0.0: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. warning sql-language-server > sqlite3 > node-gyp > make-fetch-happen > cacache > @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs [2/4] Fetching packages... warning vscode-languageclient@6.1.4: The engine "vscode" appears to be invalid. info fsevents@2.3.3: The platform "linux" is incompatible with this module. info "fsevents@2.3.3" is an optional dependency and failed compatibility check. Excluding it from installation. [3/4] Linking dependencies... [4/4] Building fresh packages... success Saved lockfile. warning No license field warning Your current version of Yarn is out of date. The latest version is "1.22.19", while you're on "1.21.1". success Saved 150 new dependencies. info Direct dependencies ├─ bash-language-server@5.0.0 ├─ dockerfile-language-server-nodejs@0.11.0 ├─ javascript-typescript-langserver@2.11.3 ├─ sql-language-server@1.7.0 ├─ unified-language-server@3.1.0 ├─ vscode-css-languageserver-bin@1.4.0 ├─ vscode-html-languageserver-bin@1.4.0 ├─ vscode-json-languageserver-bin@1.0.1 └─ yaml-language-server@1.14.0 info All dependencies ├─ @gar/promisify@1.1.3 ├─ @google-cloud/bigquery@5.12.0 ├─ @google-cloud/common@3.10.0 ├─ @google-cloud/paginator@3.0.7 ├─ @google-cloud/projectify@2.1.1 ├─ @mapbox/node-pre-gyp@1.0.11 ├─ @npmcli/fs@1.1.1 ├─ @npmcli/move-file@1.1.2 ├─ @types/pg@8.10.2 ├─ abbrev@1.1.1 ├─ abort-controller@3.0.0 ├─ agentkeepalive@4.5.0 ├─ aggregate-error@3.1.0 ├─ ansicolors@0.3.2 ├─ aproba@2.0.0 ├─ are-we-there-yet@2.0.0 ├─ asn1@0.2.6 ├─ assertion-error@1.1.0 ├─ base64-js@1.5.1 ├─ bash-language-server@5.0.0 ├─ bcrypt-pbkdf@1.0.2 ├─ big.js@6.2.1 ├─ bignumber.js@9.1.2 ├─ buffer-equal-constant-time@1.0.1 ├─ bufrw@1.3.0 ├─ cacache@15.3.0 ├─ cardinal@2.1.1 ├─ chai-as-promised@7.1.1 ├─ chai@4.3.8 ├─ chownr@2.0.0 ├─ clean-stack@2.2.0 ├─ color-support@1.1.3 ├─ deep-eql@4.1.3 ├─ delegates@1.0.0 ├─ denque@2.1.0 ├─ detect-libc@2.0.2 ├─ dockerfile-language-server-nodejs@0.11.0 ├─ dockerfile-language-service@0.11.0 ├─ duplexify@4.1.2 ├─ ecdsa-sig-formatter@1.0.11 ├─ encoding@0.1.13 ├─ ent@2.2.0 ├─ env-paths@2.2.1 ├─ err-code@2.0.3 ├─ error@7.0.2 ├─ event-target-shim@5.0.1 ├─ fast-json-patch@2.2.1 ├─ fast-text-encoding@1.0.6 ├─ fs-minipass@2.1.0 ├─ gauge@3.0.2 ├─ gcp-metadata@4.3.1 ├─ generate-function@2.3.1 ├─ google-auth-library@7.14.1 ├─ google-p12-pem@3.1.4 ├─ gtoken@5.3.2 ├─ has-unicode@2.0.1 ├─ hexer@1.5.0 ├─ http-cache-semantics@4.1.1 ├─ humanize-ms@1.2.1 ├─ iconv-lite@0.6.3 ├─ indent-string@4.0.0 ├─ infer-owner@1.0.4 ├─ ip@2.0.0 ├─ is-lambda@1.0.1 ├─ is-property@1.0.2 ├─ is@3.3.0 ├─ iterare@1.2.1 ├─ jaeger-client@3.19.0 ├─ javascript-typescript-langserver@2.11.3 ├─ json-bigint@1.0.0 ├─ jwa@2.0.0 ├─ lodash@4.17.21 ├─ long@4.0.0 ├─ loupe@2.3.6 ├─ make-fetch-happen@9.1.0 ├─ minimist@1.2.8 ├─ minipass-fetch@1.4.1 ├─ minipass-pipeline@1.2.4 ├─ minipass-sized@1.0.3 ├─ minizlib@2.1.2 ├─ mkdirp@1.0.4 ├─ mysql2@2.3.3 ├─ mz@2.7.0 ├─ named-placeholders@1.1.3 ├─ negotiator@0.6.3 ├─ node-addon-api@4.3.0 ├─ node-forge@1.3.1 ├─ node-gyp@8.4.1 ├─ node-ssh-forward@0.6.3 ├─ nopt@5.0.0 ├─ npmlog@5.0.1 ├─ object-assign@4.1.1 ├─ object-hash@1.3.1 ├─ obuf@1.1.2 ├─ opentracing@0.14.7 ├─ p-event@4.2.0 ├─ p-map@4.0.0 ├─ p-timeout@3.2.0 ├─ pathval@1.1.1 ├─ peggy@3.0.2 ├─ pg-cloudflare@1.1.1 ├─ pg-connection-string@2.6.2 ├─ pg-numeric@1.0.2 ├─ pg-pool@3.6.1 ├─ pg-protocol@1.6.0 ├─ pg@8.11.3 ├─ postgres-range@1.1.3 ├─ process@0.10.1 ├─ promise-inflight@1.0.1 ├─ promise-retry@2.0.1 ├─ readable-stream@3.6.2 ├─ redeyed@2.1.1 ├─ retry-request@4.2.2 ├─ retry@0.12.0 ├─ rxjs@5.5.12 ├─ semaphore-async-await@1.5.1 ├─ seq-queue@0.0.5 ├─ smart-buffer@4.2.0 ├─ socks-proxy-agent@6.2.1 ├─ socks@2.7.1 ├─ source-map-generator@0.8.0 ├─ sql-language-server@1.7.0 ├─ sqlint@1.7.0 ├─ sqlite3@5.1.6 ├─ sqlstring@2.3.3 ├─ ssh2-streams@0.4.10 ├─ ssh2@0.8.9 ├─ ssri@8.0.1 ├─ stream-shift@1.0.1 ├─ streamsearch@0.1.2 ├─ string-similarity@2.0.0 ├─ stubs@3.0.0 ├─ symbol-observable@1.0.1 ├─ tar@6.2.0 ├─ teeny-request@7.2.0 ├─ thenify-all@1.6.0 ├─ thenify@3.3.1 ├─ thriftrw@3.11.4 ├─ tweetnacl@0.14.5 ├─ type-detect@4.0.8 ├─ unified-language-server@3.1.0 ├─ unique-filename@1.1.1 ├─ unique-slug@2.0.2 ├─ vscode-css-languageserver-bin@1.4.0 ├─ vscode-html-languageserver-bin@1.4.0 ├─ vscode-json-languageserver-bin@1.0.1 ├─ wide-align@1.1.5 ├─ xorshift@1.2.0 ├─ xtend@4.0.2 └─ yaml-language-server@1.14.0 Done in 76.07s.
仮想環境一覧
$ pipx list
venvs are in C:\Users\tomoyan\.local\pipx\venvs apps are exposed on your $PATH at C:\Users\tomoyan\.local\bin package jupyterlab 3.6.5 (jupyterlab3), installed using Python 3.11.4 - jlpm3.exe - jupyter-lab3.exe - jupyter-labextension3.exe - jupyter-labhub3.exe package jupyterlab 4.0.3 (jupyterlab4), installed using Python 3.11.4 - jlpm4.exe - jupyter-lab4.exe - jupyter-labextension4.exe - jupyter-labhub4.exe
JupyterLab の更新
$ pipx upgrade jupyterlab4
upgraded package jupyterlab4 from 4.0.3 to 4.0.5 (location: /home/tomoyan/.local/pipx/venvs/jupyterlab4)
コマンドライン オプション
起動コマンド | 説明 |
---|---|
$ jupyter notebook | Jupyter Notebook を起動。 |
$ jupyter-lab | JupyterLab を起動。 |
$ jupyter-lab --no-browser | JupyterLab をリモートやヘッドレスマシンなどでブラウザなしで起動。 |
$ jupyter-lab --ip=0.0.0.0 --no-browser | JupyterLab をヘッドレスマシンなどで外部アクセスを許可して起動。 |
$ jupyter-lab --version | JupyterLab のバージョンを表示。 |
$ jupyter notebook $ jupyter-lab3 $ jupyter-lab3 --no-browser $ jupyter-lab3 --ip=0.0.0.0 --no-browser $ jupyter-lab3 --version $ jupyter-lab4 $ jupyter-lab4 --no-browser $ jupyter-lab4 --ip=0.0.0.0 --no-browser $ jupyter-lab4 --version
技術情報
pipx inject すると pipx install したパッケージのバージョンが古くなる
$ jupyter-lab4 --version
4.0.6
$ pipx inject jupyterlab4 jupyterlab-drawio
injected package jupyterlab-drawio into venv jupyterlab4 done! ✨ 🌟 ✨
$ jupyter-lab4 --version
3.6.5
pipx install でインストールしたパッケージを pipx inject でインストールし直す😅
$ pipx inject jupyterlab4 jupyterlab==4.0.6
injected package jupyterlab into venv jupyterlab4 done! ✨ 🌟 ✨
$ jupyter-lab4 --version
3.6.5
Python venv モジュールがインストールされていない場合
pipx が仮想環境を正常に作成できないので OS パッケージの venv モジュールをインストールするように指示される。
$ pipx install --suffix 4 jupyterlab==4.0.6
The virtual environment was not created successfully because ensurepip is not available. On Debian/Ubuntu systems, you need to install the python3-venv package using the following command. apt install python3.11-venv You may need to use sudo with that command. After installing the python3-venv package, recreate your virtual environment. Failing command: /home/tomoyan/.local/pipx/shared/bin/python3 '/usr/bin/python3 -m venv --clear /home/tomoyan/.local/pipx/shared' failed
指示にしたがって python3.11-venv をインストールすると正常動作する。
$ sudo apt install python3.11-venv
Reading package lists... Done Building dependency tree... Done Reading state information... Done The following packages were automatically installed and are no longer required: gcc-12-base libarmadillo11 libcodec2-1.1 libgcc-12-dev libgupnp-igd-1.0-4 libjim0.81 libnfs13 libobjc-12-dev libstdc++-12-dev python3-jdcal Use 'sudo apt autoremove' to remove them. The following NEW packages will be installed: python3.11-venv 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 5884 B of archives. After this operation, 28.7 kB of additional disk space will be used. Get:1 http://ftp.riken.jp/Linux/kali kali-rolling/main amd64 python3.11-venv amd64 3.11.4-1 [5884 B] Fetched 5884 B in 1s (5166 B/s) Selecting previously unselected package python3.11-venv. (Reading database ... 403866 files and directories currently installed.) Preparing to unpack .../python3.11-venv_3.11.4-1_amd64.deb ... Unpacking python3.11-venv (3.11.4-1) ... Setting up python3.11-venv (3.11.4-1) ...
インストールログの場所
~/.local/pipx/logs/
$ cat ~/.local/pipx/logs/cmd_2023-08-06_03.18.35_pip_errors.log
PIP STDOUT ---------- Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple/ Collecting jupyterlab==3.6.5 Downloading https://www.piwheels.org/simple/jupyterlab/jupyterlab-3.6.5-py3-none-any.whl (8.9 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 8.9/8.9 MB 538.1 kB/s eta 0:00:00 Collecting ipython (from jupyterlab==3.6.5) Downloading https://www.piwheels.org/simple/ipython/ipython-8.14.0-py3-none-any.whl (798 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 798.7/798.7 kB 456.2 kB/s eta 0:00:00 Collecting packaging (from jupyterlab==3.6.5) Using cached https://www.piwheels.org/simple/packaging/packaging-23.1-py3-none-any.whl (48 kB) Collecting tornado>=6.1.0 (from jupyterlab==3.6.5) Downloading https://www.piwheels.org/simple/tornado/tornado-6.3.2-cp38-abi3-linux_armv6l.whl (425 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 425.4/425.4 kB 402.8 kB/s eta 0:00:00 Collecting jupyter-core (from jupyterlab==3.6.5) Downloading https://www.piwheels.org/simple/jupyter-core/jupyter_core-5.3.1-py3-none-any.whl (93 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 93.7/93.7 kB 166.7 kB/s eta 0:00:00 Collecting jupyterlab-server~=2.19 (from jupyterlab==3.6.5) Downloading https://www.piwheels.org/simple/jupyterlab-server/jupyterlab_server-2.24.0-py3-none-any.whl (57 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 57.3/57.3 kB 87.0 kB/s eta 0:00:00 Collecting jupyter-server<3,>=1.16.0 (from jupyterlab==3.6.5) Downloading https://www.piwheels.org/simple/jupyter-server/jupyter_server-2.7.0-py3-none-any.whl (375 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 375.1/375.1 kB 275.9 kB/s eta 0:00:00 Collecting jupyter-ydoc~=0.2.4 (from jupyterlab==3.6.5) Downloading https://www.piwheels.org/simple/jupyter-ydoc/jupyter_ydoc-0.2.5-py3-none-any.whl (6.2 kB) Collecting jupyter-server-ydoc~=0.8.0 (from jupyterlab==3.6.5) Downloading https://www.piwheels.org/simple/jupyter-server-ydoc/jupyter_server_ydoc-0.8.0-py3-none-any.whl (11 kB) Collecting nbclassic (from jupyterlab==3.6.5) Downloading https://www.piwheels.org/simple/nbclassic/nbclassic-1.0.0-py3-none-any.whl (10.0 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 10.0/10.0 MB 737.4 kB/s eta 0:00:00 Collecting notebook<7 (from jupyterlab==3.6.5) Downloading https://www.piwheels.org/simple/notebook/notebook-6.5.5-py3-none-any.whl (529 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 529.8/529.8 kB 374.7 kB/s eta 0:00:00 Collecting jinja2>=2.1 (from jupyterlab==3.6.5) Downloading https://www.piwheels.org/simple/jinja2/Jinja2-3.1.2-py3-none-any.whl (133 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 133.1/133.1 kB 157.4 kB/s eta 0:00:00 Collecting tomli (from jupyterlab==3.6.5) Downloading https://www.piwheels.org/simple/tomli/tomli-2.0.1-py3-none-any.whl (12 kB) Collecting MarkupSafe>=2.0 (from jinja2>=2.1->jupyterlab==3.6.5) Downloading https://www.piwheels.org/simple/markupsafe/MarkupSafe-2.1.3-cp39-cp39-linux_armv6l.whl (23 kB) Collecting anyio>=3.1.0 (from jupyter-server<3,>=1.16.0->jupyterlab==3.6.5) Downloading https://www.piwheels.org/simple/anyio/anyio-3.7.1-py3-none-any.whl (80 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 80.9/80.9 kB 135.9 kB/s eta 0:00:00 Collecting argon2-cffi (from jupyter-server<3,>=1.16.0->jupyterlab==3.6.5) Using cached https://www.piwheels.org/simple/argon2-cffi/argon2_cffi-21.3.0-py3-none-any.whl (14 kB) Collecting jupyter-client>=7.4.4 (from jupyter-server<3,>=1.16.0->jupyterlab==3.6.5) Downloading https://www.piwheels.org/simple/jupyter-client/jupyter_client-8.3.0-py3-none-any.whl (103 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 103.2/103.2 kB 146.2 kB/s eta 0:00:00 Collecting jupyter-events>=0.6.0 (from jupyter-server<3,>=1.16.0->jupyterlab==3.6.5) Downloading https://www.piwheels.org/simple/jupyter-events/jupyter_events-0.7.0-py3-none-any.whl (18 kB) Collecting jupyter-server-terminals (from jupyter-server<3,>=1.16.0->jupyterlab==3.6.5) Downloading https://www.piwheels.org/simple/jupyter-server-terminals/jupyter_server_terminals-0.4.4-py3-none-any.whl (13 kB) Collecting nbconvert>=6.4.4 (from jupyter-server<3,>=1.16.0->jupyterlab==3.6.5) Downloading https://www.piwheels.org/simple/nbconvert/nbconvert-7.7.3-py3-none-any.whl (254 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 254.7/254.7 kB 239.2 kB/s eta 0:00:00 Collecting nbformat>=5.3.0 (from jupyter-server<3,>=1.16.0->jupyterlab==3.6.5) Downloading https://www.piwheels.org/simple/nbformat/nbformat-5.9.2-py3-none-any.whl (77 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 77.6/77.6 kB 118.7 kB/s eta 0:00:00 Collecting overrides (from jupyter-server<3,>=1.16.0->jupyterlab==3.6.5) Downloading https://www.piwheels.org/simple/overrides/overrides-7.3.1-py3-none-any.whl (17 kB) Collecting prometheus-client (from jupyter-server<3,>=1.16.0->jupyterlab==3.6.5) Downloading https://www.piwheels.org/simple/prometheus-client/prometheus_client-0.17.1-py3-none-any.whl (60 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 60.6/60.6 kB 122.7 kB/s eta 0:00:00 Collecting pyzmq>=24 (from jupyter-server<3,>=1.16.0->jupyterlab==3.6.5) Downloading https://www.piwheels.org/simple/pyzmq/pyzmq-25.1.0-cp39-cp39-linux_armv6l.whl (6.6 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.6/6.6 MB 774.3 kB/s eta 0:00:00 Collecting send2trash (from jupyter-server<3,>=1.16.0->jupyterlab==3.6.5) Downloading https://www.piwheels.org/simple/send2trash/Send2Trash-1.8.2-py3-none-any.whl (18 kB) Collecting terminado>=0.8.3 (from jupyter-server<3,>=1.16.0->jupyterlab==3.6.5) Downloading https://www.piwheels.org/simple/terminado/terminado-0.17.1-py3-none-any.whl (17 kB) Collecting traitlets>=5.6.0 (from jupyter-server<3,>=1.16.0->jupyterlab==3.6.5) Downloading https://www.piwheels.org/simple/traitlets/traitlets-5.9.0-py3-none-any.whl (117 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.4/117.4 kB 209.1 kB/s eta 0:00:00 Collecting websocket-client (from jupyter-server<3,>=1.16.0->jupyterlab==3.6.5) Downloading https://www.piwheels.org/simple/websocket-client/websocket_client-1.6.1-py3-none-any.whl (56 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 56.9/56.9 kB 171.6 kB/s eta 0:00:00 Collecting platformdirs>=2.5 (from jupyter-core->jupyterlab==3.6.5) Downloading https://www.piwheels.org/simple/platformdirs/platformdirs-3.10.0-py3-none-any.whl (17 kB) Collecting jupyter-server-fileid<1,>=0.6.0 (from jupyter-server-ydoc~=0.8.0->jupyterlab==3.6.5) Downloading https://www.piwheels.org/simple/jupyter-server-fileid/jupyter_server_fileid-0.9.0-py3-none-any.whl (15 kB) Collecting ypy-websocket<0.9.0,>=0.8.2 (from jupyter-server-ydoc~=0.8.0->jupyterlab==3.6.5) Downloading https://www.piwheels.org/simple/ypy-websocket/ypy_websocket-0.8.4-py3-none-any.whl (10 kB) Collecting importlib-metadata>=3.6 (from jupyter-ydoc~=0.2.4->jupyterlab==3.6.5) Downloading https://www.piwheels.org/simple/importlib-metadata/importlib_metadata-6.8.0-py3-none-any.whl (22 kB) Collecting y-py<0.7.0,>=0.6.0 (from jupyter-ydoc~=0.2.4->jupyterlab==3.6.5) Downloading y_py-0.6.0.tar.gz (52 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 52.9/52.9 kB 556.9 kB/s eta 0:00:00 Installing build dependencies: started Installing build dependencies: finished with status 'done' Getting requirements to build wheel: started Getting requirements to build wheel: finished with status 'done' Preparing metadata (pyproject.toml): started Preparing metadata (pyproject.toml): finished with status 'error' PIP STDERR ---------- WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))': /simple/jupyterlab/jupyterlab-3.6.5-py3-none-any.whl error: subprocess-exited-with-error × Preparing metadata (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [3 lines of output] Error running maturin: Command '['maturin', 'pep517', 'write-dist-info', '--metadata-directory', '/tmp/pip-modern-metadata-_dgl_ar0', '--interpreter', '/home/dietpi/.local/pipx/venvs/jupyterlab3/bin/python']' died with <Signals.SIGILL: 4>. Checking for Rust toolchain.... Running `maturin pep517 write-dist-info --metadata-directory /tmp/pip-modern-metadata-_dgl_ar0 --interpreter /home/dietpi/.local/pipx/venvs/jupyterlab3/bin/python` [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed × Encountered error while generating package metadata. ╰─> See above for output. note: This is an issue with the package mentioned above, not pip. hint: See above for details. dietpi@dietpi-001:~$ pipx install --suffix 3 jupyterlab==3.6.5 Fatal error from pip prevented installation. Full pip output in file: /home/dietpi/.local/pipx/logs/cmd_2023-08-06_03.31.19_pip_errors.log pip seemed to fail to build package: y-py<0.7.0,>=0.6.0 Some possibly relevant errors from pip install: error: subprocess-exited-with-error error: metadata-generation-failed Error installing jupyterlab from spec 'jupyterlab==3.6.5'.
$ pip install y-py --user
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple/ Collecting y-py Using cached y_py-0.6.0.tar.gz (52 kB) Installing build dependencies ... -⌫ ⌫\⌫ ⌫|⌫ ⌫/⌫ ⌫-⌫ ⌫\⌫ ⌫|⌫ ⌫done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... -⌫ ⌫error error: subprocess-exited-with-error × Preparing metadata (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [3 lines of output] Error running maturin: Command '['maturin', 'pep517', 'write-dist-info', '--metadata-directory', '/tmp/pip-modern-metadata-0iw3tc63', '--interpreter', '/usr/bin/python3']' died with <Signals.SIGILL: 4>. Checking for Rust toolchain.... Running `maturin pep517 write-dist-info --metadata-directory /tmp/pip-modern-metadata-0iw3tc63 --interpreter /usr/bin/python3` [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed × Encountered error while generating package metadata. ╰─> See above for output. note: This is an issue with the package mentioned above, not pip. hint: See above for details.