webmaster-kazu.com

テクノロジー・データ分析・実践ログ・その他

Pythonの依存関係の管理とパッケージ化が簡単にできる「poetry」のインストール

カテゴリ: Python【初歩から現場実務的なもの】

Pythonの依存関係の管理とパッケージ化が簡単にできる「poetry」のインストールについて解説しています。

「poetry(https://python-poetry.org/,https://github.com/python-poetry/poetry)」は、Pythonプロジェクトの依存関係の宣言、管理、インストールが簡単に行えるライブラリです。

■Python

今回のPythonのバージョンは、「3.8.5」を使用しています。(Windows10)(pythonランチャーでの確認)

■poetryをインストールする

poetryをインストールを行いますが、今回はpipを経由してインストールを行うので、まずWindowsのコマンドプロンプトを起動します。

pip install poetry

起動後、上記のコマンドを入力し、Enterキーを押します。

なお、今回は、pythonランチャーを使用しており、Python Version 3.8.5にインストールを行うために、バージョンの切り替えを行います。

py -3.8 -m pip install poetry

切り替えるために、上記のコマンドを入力し、Enterキーを押します。

Defaulting to user installation because normal site-packages is not writeable

Collecting poetry

Downloading poetry-1.1.14-py2.py3-none-any.whl (175 kB)

---------------------------------------- 175.1/175.1 kB 1.0 MB/s eta 0:00:00

Collecting tomlkit<1.0.0,>=0.7.0

Downloading tomlkit-0.11.1-py3-none-any.whl (34 kB)

Collecting cachecontrol[filecache]<0.13.0,>=0.12.9

Downloading CacheControl-0.12.11-py2.py3-none-any.whl (21 kB)

Collecting pexpect<5.0.0,>=4.7.0

Downloading pexpect-4.8.0-py2.py3-none-any.whl (59 kB)

---------------------------------------- 59.0/59.0 kB 3.3 MB/s eta 0:00:00

Collecting requests-toolbelt<0.10.0,>=0.9.1

Using cached requests_toolbelt-0.9.1-py2.py3-none-any.whl (54 kB)

Collecting cleo<0.9.0,>=0.8.1

Downloading cleo-0.8.1-py2.py3-none-any.whl (21 kB)

Collecting crashtest<0.4.0,>=0.3.0

Downloading crashtest-0.3.1-py3-none-any.whl (7.0 kB)

Collecting shellingham<2.0,>=1.1

Using cached shellingham-1.4.0-py2.py3-none-any.whl (9.4 kB)

Collecting html5lib<2.0,>=1.0

Using cached html5lib-1.1-py2.py3-none-any.whl (112 kB)

Collecting packaging<21.0,>=20.4

Using cached packaging-20.9-py2.py3-none-any.whl (40 kB)

Collecting pkginfo<2.0,>=1.4

Downloading pkginfo-1.8.3-py2.py3-none-any.whl (26 kB)

Collecting clikit<0.7.0,>=0.6.2

Downloading clikit-0.6.2-py2.py3-none-any.whl (91 kB)

---------------------------------------- 91.8/91.8 kB 5.1 MB/s eta 0:00:00

Requirement already satisfied: requests<3.0,>=2.18 in c:\users\user_\appdata\roaming\python\python38\site-packages (from poetry) (2.28.1)

Collecting cachy<0.4.0,>=0.3.0

Downloading cachy-0.3.0-py2.py3-none-any.whl (20 kB)

Collecting keyring>=21.2.0

Downloading keyring-23.7.0-py3-none-any.whl (34 kB)

Collecting poetry-core<1.1.0,>=1.0.7

Using cached poetry_core-1.0.8-py2.py3-none-any.whl (425 kB)

Requirement already satisfied: virtualenv<21.0.0,>=20.0.26 in c:\users\user_\appdata\roaming\python\python38\site-packages (from poetry) (20.16.2)

Collecting msgpack>=0.5.2

Downloading msgpack-1.0.4-cp38-cp38-win_amd64.whl (62 kB)

---------------------------------------- 62.2/62.2 kB 1.7 MB/s eta 0:00:00

Collecting lockfile>=0.9

Downloading lockfile-0.12.2-py2.py3-none-any.whl (13 kB)

Collecting pastel<0.3.0,>=0.2.0

Downloading pastel-0.2.1-py2.py3-none-any.whl (6.0 kB)

Collecting pylev<2.0,>=1.3

Downloading pylev-1.4.0-py2.py3-none-any.whl (6.1 kB)

Collecting webencodings

Using cached webencodings-0.5.1-py2.py3-none-any.whl (11 kB)

Requirement already satisfied: six>=1.9 in c:\users\user_\appdata\roaming\python\python38\site-packages (from html5lib<2.0,>=1.0->poetry) (1.16.0)

Collecting importlib-metadata>=3.6

Using cached importlib_metadata-4.12.0-py3-none-any.whl (21 kB)

Collecting pywin32-ctypes!=0.1.0,!=0.1.1

Downloading pywin32_ctypes-0.2.0-py2.py3-none-any.whl (28 kB)

Collecting pyparsing>=2.0.2

Using cached pyparsing-3.0.9-py3-none-any.whl (98 kB)

Collecting ptyprocess>=0.5

Downloading ptyprocess-0.7.0-py2.py3-none-any.whl (13 kB)

Requirement already satisfied: charset-normalizer<3,>=2 in c:\users\user_\appdata\roaming\python\python38\site-packages (from requests<3.0,>=2.18->poetry) (2.1.0)

Requirement already satisfied: idna<4,>=2.5 in c:\users\user_\appdata\roaming\python\python38\site-packages (from requests<3.0,>=2.18->poetry) (3.3)

Requirement already satisfied: certifi>=2017.4.17 in c:\users\user_\appdata\roaming\python\python38\site-packages (from requests<3.0,>=2.18->poetry) (2022.6.15)

Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\user_\appdata\roaming\python\python38\site-packages (from requests<3.0,>=2.18->poetry) (1.26.11)

Requirement already satisfied: platformdirs<3,>=2 in c:\users\user_\appdata\roaming\python\python38\site-packages (from virtualenv<21.0.0,>=20.0.26->poetry) (2.5.2)

Requirement already satisfied: filelock<4,>=3.2 in c:\users\user_\appdata\roaming\python\python38\site-packages (from virtualenv<21.0.0,>=20.0.26->poetry) (3.7.1)

Requirement already satisfied: distlib<1,>=0.3.1 in c:\users\user_\appdata\roaming\python\python38\site-packages (from virtualenv<21.0.0,>=20.0.26->poetry) (0.3.5)

Collecting zipp>=0.5

Using cached zipp-3.8.1-py3-none-any.whl (5.6 kB)

Installing collected packages: webencodings, pywin32-ctypes, pylev, ptyprocess, msgpack, lockfile, zipp, tomlkit, shellingham, pyparsing, poetry-core, pkginfo, pexpect, pastel, html5lib, crashtest, cachy, requests-toolbelt, packaging, importlib-metadata, clikit, cachecontrol, keyring, cleo, poetry

Successfully installed cachecontrol-0.12.11 cachy-0.3.0 cleo-0.8.1 clikit-0.6.2 crashtest-0.3.1 html5lib-1.1 importlib-metadata-4.12.0 keyring-23.7.0 lockfile-0.12.2 msgpack-1.0.4 packaging-20.9 pastel-0.2.1 pexpect-4.8.0 pkginfo-1.8.3 poetry-1.1.14 poetry-core-1.0.8 ptyprocess-0.7.0 pylev-1.4.0 pyparsing-3.0.9 pywin32-ctypes-0.2.0 requests-toolbelt-0.9.1 shellingham-1.4.0 tomlkit-0.11.1 webencodings-0.5.1 zipp-3.8.1

Enterキーを押すと、インストールが開始され、上記のように「Successfully installed」と表示されます。これが表示されれば、poetryが正常にインストールされたことになります。

なお、今回はpoetryのバージョン1.1.14をインストールしました。