[英]400 ERROR: Invalid URI when uploading new PyPI package (twine)
I followed the official documentation for uploading packages to PyPI, as well as the information provided in PyPI readme, but I get a HTTP 400 error each time:我遵循了将包上传到 PyPI 的官方文档,以及 PyPI 自述文件中提供的信息,但每次都会收到 HTTP 400 错误:
$ twine upload dist/*
Uploading distributions to https://upload.pypi.org/legacy/
Enter your username: bradaallen
Enter your password:
Uploading brad_nlp_helpers-0.1.1-py3-none-any.whl
HTTPError: 400 Client Error: home_page: Invalid URI for url:
https://upload.pypi.org/legacy/
I am using a ~/.pypirc我正在使用 ~/.pypirc
[distutils]
index-servers =
pypi
pypitest
[pypi]
username=bradaallen
password=[password]
[pypitest]
username=bradaallen
password=[password]
For packages, I am using twine version 1.9.1 (pkginfo: 1.4.1, requests: 2.12.4, setuptools: 27.2.0, requests-toolbelt: 0.8.0, tqdm: 4.14.0)
对于软件包,我使用的是twine version 1.9.1 (pkginfo: 1.4.1, requests: 2.12.4, setuptools: 27.2.0, requests-toolbelt: 0.8.0, tqdm: 4.14.0)
When I use python setup.py sdist bdist_wheel upload
I get the same issue:当我使用python setup.py sdist bdist_wheel upload
时,我遇到了同样的问题:
Submitting dist\brad_nlp_helpers-0.1.1.tar.gz to
https://upload.pypi.org/legacy/ Upload failed (400): home_page: Invalid URI
error: Upload failed (400): home_page: Invalid URI
I have not specified the repository, as that is recommendation that is given by the API when uploading.我没有指定存储库,因为这是 API 在上传时给出的建议。 I am seeing a 404 error
at the link that PyPI recommends and am not seeing an alternative site I should use!我在 PyPI 推荐的链接上看到404 error
,并且没有看到我应该使用的替代网站!
This is my first package, and I am not seeing this error elsewhere on the internet.这是我的第一个包,我在互联网上的其他地方没有看到这个错误。 Any thoughts re: what's going on?有什么想法:这是怎么回事?
Amazing.惊人。 I also posted this as an Issue on Twine's GitHub page .我还在Twine 的 GitHub 页面上将此作为问题发布。
It turns out the URL in the setup.py
file should correspond to where the code is being hosted (which makes sense).事实证明setup.py
文件中的 URL 应该对应于托管代码的位置(这是有道理的)。 I had put my personal website as the URL and I guess the unit tests at Warehouse were rejecting me... it's now uploaded.我把我的个人网站作为 URL,我猜 Warehouse 的单元测试拒绝了我……它现在已经上传了。
Thank you again @phd!再次感谢@phd!
Just a few minutes ago tried to upload a package and got this problem.就在几分钟前尝试上传一个包并遇到了这个问题。 :-) To fix: upgrade pip
, setuptools
and twine
to the very latest versions: :-) 修复:将pip
、 setuptools
和twine
升级到最新版本:
pip install -U pip setuptools twine
Remove or comment out repository from ~/.pypirc
:从~/.pypirc
中删除或注释掉存储库:
[distutils]
index-servers =
pypi
[pypi]
#repository:
username: …
twine upload
now works! twine upload
现在有效!
When you run $ twine upload dist/*
it means you are redeploying all versions of the package available in project directory.当您运行$ twine upload dist/*
时,这意味着您正在重新部署项目目录中可用的所有版本的包。 Your error shows that previous version 0.0.1 already exists in your pypi.org account.您的错误表明您的 pypi.org 帐户中已经存在以前的版本0.0.1 。 It shouldn't be redeployed unless deleted from your pypi.org account.除非从您的 pypi.org 帐户中删除,否则不应重新部署它。
Solution:解决方案:
Always specify the version your latest wheel generated after modifying your package code by running通过运行修改包代码后,始终指定最新轮子生成的版本
$ twine upload dist/<your-latest-whl-version>
check your setup.py file检查你的 setup.py 文件
put url =""把网址=“”
build again再次构建
check查看
PKG-INFO inside the src//PKG-INFO src//PKG-INFO里面的PKG-INFO
Home-page: if it is there go on deploy主页:如果有,请继续部署
thanks谢谢
When you use README.md file as long_description in the setup.py, some strings such as ".*" do not support in PyPI.当您在 setup.py 中使用 README.md 文件作为 long_description 时,PyPI 中不支持某些字符串,例如“.*”。 So, there is a need to remove them and rebuild the WHL file and upload it again by twine.因此,需要删除它们并重建 WHL 文件并通过麻线再次上传。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.