🐍
poetryのインストーラを新しいものに移行しなければならない
概要
2022/8/31にpoetry1.2.0が公開されました。同時に今まで使っていたインストーラが使えなくなったので移行方法をメモします。
エラーが出た状況
docker環境でpoetryを使っていました。今まで使っていたのはこれ
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
エラー
#10 0.445 Retrieving Poetry metadata
#10 0.445
#10 0.445 This installer is deprecated, and scheduled for removal from the Poetry repository on or after January 1, 2023.
#10 0.445 See https://github.com/python-poetry/poetry/issues/6377 for details.
#10 0.445
#10 0.445 You should migrate to https://install.python-poetry.org instead, which supports all versions of Poetry, and allows for `self update` of versions 1.1.7 or newer.
#10 0.445 Instructions are available at https://python-poetry.org/docs/#installation.
#10 0.445
#10 0.445 Without an explicit version, this installer will attempt to install the latest version of Poetry.
#10 0.445 This installer cannot install Poetry 1.2.0a1 or newer (and installs will be unable to `self update` to 1.2.0a1 or newer).
#10 0.445
#10 0.445 To continue to use this deprecated installer, you must specify an explicit version with --version <version> or POETRY_VERSION=<version>.
#10 0.445 Alternatively, if you wish to force this deprecated installer to use the latest installable release, set GET_POETRY_IGNORE_DEPRECATION=1.
#10 0.445
#10 0.445 Version 1.2.0 is not supported by this installer! Please specify a version prior to 1.2.0a1 to continue!
やったこと
言われた通りに指定するURLを変えてみる
RUN curl -sSL https://install.python-poetry.org | python -
違うエラーが出た
> [6/6] RUN poetry install --no-dev:
#11 0.164 /bin/sh: 1: poetry: not found
poetryが通ってないね、パスを指定しよう
解決
- RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
+ RUN curl -sSL https://install.python-poetry.org | POETRY_HOME=/opt/poetry python3 -
+ ENV PATH="/opt/poetry/bin:$PATH"
参考
Discussion