LoginSignup
1
0

More than 5 years have passed since last update.

【Python】PyPIエラー対応 File already existsの対処法

Posted at

発生したエラー

twineを使って、PythonパッケージをPyPIに登録しようとしたところ、

HTTPError: 400 Client Error: File already exists. See https://pypi.org/help/#file-name-reuse for url: https://upload.pypi.org/legacy/

のエラーとなる。

$ twine upload --repository pypi dist/*
Enter your username: hogefuga
Enter your password: 
Uploading distributions to https://upload.pypi.org/legacy/
Uploading cc
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 11.4k/11.4k [00:01<00:00, 9.14kB/s]
NOTE: Try --verbose to see response content.
HTTPError: 400 Client Error: File already exists. See https://pypi.org/help/#file-name-reuse for url: https://upload.pypi.org/legacy/
$

対処方法

原因は、PyPIに登録済みのパッケージとファイル名が重複してしまっているため。

PyPIには同じバージョンのパッケージを再登録はできない。

setup.pyversionを変更した上で、python setup.py bdist_wheelでパッケージファイルを作り直すことで、登録が可能。

setup.py
#!/usr/bin/env python
# coding: utf-8

from setuptools import setup, find_packages
from codecs import open
from os import path

here = path.abspath(path.dirname(__file__))

with open(path.join(here, 'README.md'), encoding='utf-8') as f:
    long_description = f.read()

setup(
    name='gokulang',
    packages=['gokulang'],

    version='1.0.1', # 1.0.0 => 1.0.1 に変更
# ...

環境

  • Python 3.6.6
  • twine 1.13.0
1
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
1
0