0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

PyPI にパッケージがアップロードできなくなったときの対処法 (InvalidDistribution: Make sure the distribution is using a supported Metadata-Version: 1.0, ..., 2.3.)

Posted at

Python パッケージをビルドしていざ PyPI にアップロードしようとしたら以下のエラーにアップロードを阻まれて困った人向けです。twine をアップグレードしても直りません。結論からいうと pip install --upgrade pkginfo で直りました (私は)。

$ python -m twine upload dist/*
Uploading distributions to https://upload.pypi.org/legacy/
ERROR    InvalidDistribution: Make sure the distribution is using a supported
         Metadata-Version: 1.0, 1.1, 1.2, 2.0, 2.1, 2.2, 2.3.

上記のエラーになっていたとき、twinepkginfo のバージョンが以下でした。

$ pip list | grep -E "twine|pkginfo"
pkginfo                                 1.11.2
twine                                   6.0.1

pkginfopip install --upgrade pkginfo でアップグレードして (以下の状態)、ビルド&アップロードをやり直したらエラーは出なくなりアップロードできました。

$ pip list | grep -E "twine|pkginfo"
pkginfo                                 1.12.0
twine                                   6.0.1

参考文献

以下に同じ状況の人がたくさんいました。7 コメント目の umarbutler さんが pkginfo をアップグレードすると解決すると教えてくださっていました。

経緯

久しぶりに新しいパッケージを PyPI にアップロードしようと以下を実行したところ、記事タイトルのエラーに阻まれました。

pip install --upgrade build  # build パッケージのアップグレード
python -m build  # ビルド
pip install --upgrade twine  # twine (PyPI にアップロードするツール) のアップグレード
python -m twine upload dist/*  # アップロード

pyproject.toml のフィールドに過不足があるのか調べたり1、変なバージョン名を付けたのが悪かったのか調べたり2しましたが、以下のチェックはエラーを吐き続けました。

twine check dist/*

が、参考文献をみつけて解決しました。

  1. ビルド&アップロードに成功した版の pyproject.tomlこちらです。

  2. 本記事の趣旨と関係ありませんがPEP 440 (Python のバージョン・スキーマ) 概説が参考になりました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?