🧩
poetryをアップデートしたら、poetry shellコマンドが使えない
poetry shell
で仮想環境に入ろうとすると、入れなくなっていました。
poetry shell
The command "shell" does not exist.
調べてみると「シェルコマンドはプラグインに移された」とのこと、、。
さっそくプラグインをインストール
poetry self add poetry-plugin-shell
しかしエラー
エラー文
Using version ^1.0.1 for poetry-plugin-shell
Updating dependencies
Resolving dependencies... (0.5s)
Package operations: 3 installs, 3 updates, 0 removals
- Updating more-itertools (10.5.0 -> 10.6.0): Failed
CalledProcessError
Command '['/opt/homebrew/Cellar/poetry/2.0.1/libexec/bin/python', '/opt/homebrew/Cellar/poetry/2.0.1/libexec/lib/python3.13/site-packages/virtualenv/seed/wheels/embed/pip-24.3.1-py3-none-any.whl/pip', 'uninstall', 'more-itertools', '-y']' returned non-zero exit status 1.
at /opt/homebrew/Cellar/python@3.13/3.13.1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/subprocess.py:577 in run
573│ # We don't call process.wait() as .__exit__ does that for us.
574│ raise
575│ retcode = process.poll()
576│ if check and retcode:
→ 577│ raise CalledProcessError(retcode, process.args,
578│ output=stdout, stderr=stderr)
579│ return CompletedProcess(process.args, retcode, stdout, stderr)
580│
581│
The following error occurred when trying to handle this error:
EnvCommandError
Command ['/opt/homebrew/Cellar/poetry/2.0.1/libexec/bin/python', '/opt/homebrew/Cellar/poetry/2.0.1/libexec/lib/python3.13/site-packages/virtualenv/seed/wheels/embed/pip-24.3.1-py3-none-any.whl/pip', 'uninstall', 'more-itertools', '-y'] errored with the following return code 1
Output:
Found existing installation: more-itertools 10.5.0
error: uninstall-no-record-file
× Cannot uninstall more-itertools 10.5.0
╰─> The package's contents are unknown: no RECORD file was found for more-itertools.
hint: The package was installed by brew. You should check if it can uninstall the package.
at /opt/homebrew/Cellar/poetry/2.0.1/libexec/lib/python3.13/site-packages/poetry/utils/env/base_env.py:342 in _run
338│ output = subprocess.check_output(
339│ cmd, stderr=stderr, env=env, text=True, encoding=encoding, **kwargs
340│ )
341│ except CalledProcessError as e:
→ 342│ raise EnvCommandError(e)
343│
344│ return output
345│
346│ def execute(self, bin: str, *args: str, **kwargs: Any) -> int:
Cannot install more-itertools.
poetryをHomebrewで管理していることによるエラーぽいので、pipでpoetryをインストールし直しました。
すると成功。
poetry self add poetry-plugin-shell
Using version ^1.0.1 for poetry-plugin-shell
Updating dependencies
Resolving dependencies... (0.9s)
Package operations: 3 installs, 0 updates, 0 removals
- Installing ptyprocess (0.7.0)
- Installing pexpect (4.9.0)
- Installing poetry-plugin-shell (1.0.1)
Writing lock file
無事、仮想環境に入れるようになりました。
Discussion