首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Twine不允许我注册或上传我的包裹: https://upload.pypi.org/legacy/错了吗?

Twine不允许我注册或上传我的包裹: https://upload.pypi.org/legacy/错了吗?
EN

Stack Overflow用户
提问于 2017-08-01 19:02:20
回答 1查看 4.3K关注 0票数 4

我有一个Python包,我正试图在PyPI上注册。我正在尝试使用最新版本的twine (1.9.1)并遵循捻线网页上的说明来实现这一点。

我的包在本地配置正确。(setup.py已经完成了所有这些。)这个名字还没有在PyPI上声明。我在PyPI上有个账户。我的机器上没有~/.pypirc文件。我已经建立了一个源分布和一个轮子。

代码语言:javascript
运行
复制
> ll dist
total 64
-rw-r--r--  1 billmcn  staff  14184 Aug  1 13:35 mycroft-1.1.0.tar.gz
-rw-r--r--  1 billmcn  staff  15996 Aug  1 13:36 mycroft-1.1.0-py3-none-any.whl

当我尝试注册这些包中的任何一个时,我会得到以下错误消息。

代码语言:javascript
运行
复制
> twine register dist/mycroft-1.1.0.tar.gz 
Registering package to https://upload.pypi.org/legacy/
Enter your username: billmcn
Enter your password: 
Registering mycroft-1.1.0.tar.gz
HTTPError: 410 Client Error: Project pre-registration is no longer required or supported, so continue directly to uploading files. for url: https://upload.pypi.org/legacy/

当我尝试注册轮式文件时,我会得到同样的错误消息。这让我觉得这个注册步骤是不必要的。然而,当我试图上传我的软件包时,我看到了这个。

代码语言:javascript
运行
复制
> twine upload dist/*
Uploading distributions to https://upload.pypi.org/legacy/
Enter your username: billmcn
Enter your password: 
Uploading mycroft-1.1.0-py3-none-any.whl
[================================] 23132/23132 - 00:00:00
HTTPError: 403 Client Error: You are not allowed to upload to 'mycroft'. for url: https://upload.pypi.org/legacy/

如果您在试图上传包之前没有注册您的软件包,这看起来就像您所得到的错误。当我浏览它在PyPI站点上时,我没有看到我的包裹。所以我卡住了。

https://upload.pypi.org/legacy/在我看来有点可疑。我应该指定其他URL吗?

我怎么登记我的包裹?

这看起来类似于使用twine将包上传到pypi :无效URI。问题是这个人在他们的url函数中有一个无效的setup.py:setup关键字参数。但是,我的URL是项目的github页面https://github.com/wpm/mycroft,并且是正确的。

如果我有以下~/.pypirc文件,我也会看到同样的问题:

代码语言:javascript
运行
复制
[distutils]
index-servers =
  pypi
  pypitest

[pypi]
username=billmcn
password=********

[pypitest]
username=billmcn
password=********

手动指定上传URL的各种尝试。

代码语言:javascript
运行
复制
twine upload dist/* -r https://pypi.python.org/pypi
KeyError: Missing 'https://pypi.python.org/pypi' section from the configuration file
or not a complete URL in --repository.
Maybe you have a out-dated '~/.pypirc' format?
more info: https://docs.python.org/distutils/packageindex.html#pypirc

--help文本说,twine应该能够确定我是在指定存储库名称还是URL,但是让我们明确一下。

代码语言:javascript
运行
复制
> twine upload dist/* --repository-url https://pypi.python.org/pypi
Uploading distributions to https://pypi.python.org/pypi
Note: you are uploading to the old upload URL. It's recommended to use the new URL "https://upload.pypi.org/legacy/" or to leave the URL unspecified and allow twine to choose.
Enter your username: billmcn
Enter your password: 
Uploading mycroft-1.1.0-py3-none-any.whl
HTTPError: 410 Client Error: Gone (This API has been deprecated and removed from legacy PyPI in favor of using the APIs available in the new PyPI.org implementation of PyPI (located at https://pypi.org/). For more information about migrating your use of this API to PyPI.org, please see https://packaging.python.org/guides/migrating-to-pypi-org/#uploading. For more information about the sunsetting of this API, please see https://mail.python.org/pipermail/distutils-sig/2017-June/030766.html) for url: https://pypi.python.org/pypi

所以我应该使用“新”URL https://upload.pypi.org/legacy/

代码语言:javascript
运行
复制
> twine upload dist/* --repository-url https://upload.pypi.org/legacy/
Uploading distributions to https://upload.pypi.org/legacy/
Enter your username: billmcn
Enter your password: 
Uploading mycroft-1.1.0-py3-none-any.whl
HTTPError: 403 Client Error: You are not allowed to upload to 'mycroft'. for url: https://upload.pypi.org/legacy/                                                               

我很困惑。我也找不到当前正确网址的任何官方来源。

我想让缠绕线工作,因为Python文档建议不要使用python setup.py registerpython setup.py upload

无论如何,我都试过了,遇到了一个看似相同的问题。

代码语言:javascript
运行
复制
> python setup.py register
running register
running egg_info
writing mycroft.egg-info/PKG-INFO
writing dependency_links to mycroft.egg-info/dependency_links.txt
writing entry points to mycroft.egg-info/entry_points.txt
writing requirements to mycroft.egg-info/requires.txt
writing top-level names to mycroft.egg-info/top_level.txt
reading manifest file 'mycroft.egg-info/SOURCES.txt'
writing manifest file 'mycroft.egg-info/SOURCES.txt'
running check
We need to know who you are, so please choose either:
 1. use your existing login,
 2. register as a new user,
 3. have the server generate a new password for you (and email it to you), or
 4. quit
Your selection [default 1]: 

Username: billmcn
Password: 
Registering mycroft to https://upload.pypi.org/legacy/
Server response (410): Project pre-registration is no longer required or supported, so continue directly to uploading files.

代码语言:javascript
运行
复制
> python setup.py sdist bdist_wheel upload
...builds the packages...
running upload
Password: 
Submitting dist/mycroft-1.1.0.tar.gz to https://upload.pypi.org/legacy/
Upload failed (403): You are not allowed to upload to 'mycroft'.
error: Upload failed (403): You are not allowed to upload to 'mycroft'.

打开PyPI 第677期

EN

Stack Overflow用户

回答已采纳

发布于 2017-08-02 23:52:45

不幸的是,即使它看起来是空的并且没有任何代码,看起来在PyPI:https://pypi.python.org/pypi/mycroft/0.1.0上已经有一个'mycroft‘包了。这就是为什么api告诉您在这个包名上没有权限的原因。

它可能来自较早版本的pypi,因为它甚至没有默认版本。这可能就是为什么通过研究工具找不到它的原因。我能够使用json:https://pypi.python.org/pypi/mycroft/json找到它。

我不知道pypi在这个问题上的策略,但也许他们可以删除它,因为就连GitHub也扔了一个404。这个包可能不会被接受与新的api上传无论如何。

票数 5
EN
查看全部 1 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45445760

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档